Attached you will find a Java class called Employee. This class includes a constructor which sets name to blanks and salary to $0.00 and a constructor which sets name to a starting name and salary to a set amount. Additionally, the class includes methods to set the name and salary and return the name and salary.   You will create a new class called Manager that inherits from the attached class Employee. Add a field named department of type String. Create a get and set method for the department variable.  Supply a method toString that prints the manager's name, department, and salary. But you may not change anything in the Employee class. You will then create a test class that uses the Manager class.   The test class should prompt the user to enter name, department and salary.  This information should be stored in an array.  Upon entry of an employee records, the program should output the information you entered.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Attached you will find a Java class called Employee. This class includes a constructor which sets name to blanks and salary to $0.00 and a constructor which sets name to a starting name and salary to a set amount. Additionally, the class includes methods to set the name and salary and return the name and salary.

 

You will create a new class called Manager that inherits from the attached class Employee. Add a field named department of type String. Create a get and set method for the department variable.  Supply a method toString that prints the manager's name, department, and salary.

But you may not change anything in the Employee class.

You will then create a test class that uses the Manager class.   The test class should prompt the user to enter name, department and salary.  This information should be stored in an array.  Upon entry of an employee records, the program should output the information you entered.

1 public class Employee
2
3
public String strName, strSalary;
4
public Employee()
{
strName = " ";
strSalary
}
50
7
8
"$0";
10
110
12
13
14
15
public Employee(String Name, String Salary)
{
strName = Name;
strSalary = Salary;
}
16
170
public void setName (String Name)
{
strName = Name;
18
19
20
21
}
220
23
24
public void setSalary(String Salary)
{
strSalary = Salary;
}
25
26
270
28
29
30
31
320
33
34
public String getName()
{
return strName;
}
public String getSalary()
{
return strSalary;
}
35
36
370
38
39
40
public String toString()
{
return(strName +
}
" has a salary of
+ strSalary);
41
42 }
m mm
Transcribed Image Text:1 public class Employee 2 3 public String strName, strSalary; 4 public Employee() { strName = " "; strSalary } 50 7 8 "$0"; 10 110 12 13 14 15 public Employee(String Name, String Salary) { strName = Name; strSalary = Salary; } 16 170 public void setName (String Name) { strName = Name; 18 19 20 21 } 220 23 24 public void setSalary(String Salary) { strSalary = Salary; } 25 26 270 28 29 30 31 320 33 34 public String getName() { return strName; } public String getSalary() { return strSalary; } 35 36 370 38 39 40 public String toString() { return(strName + } " has a salary of + strSalary); 41 42 } m mm
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY