Question: Create a subfolder called polymorphism unit your unit 8 folder. Download the following classes from Blackboard and save them in the Polymorphism folder you just

Create a subfolder called polymorphism unit your unit 8 folder.

Download the following classes from Blackboard and save them in the Polymorphism folder you just created: Employee.java, Secretary.java, LegalSecretary.java, and Lawyer.java.

Review the source code for each of the files and compile them.

Add a toString method to the Employee class to print out the employee id and salary.

Write a class called Janitor to accompany the other employee classes. Janitors work twice as many hours per week as other employees (80 hours/week), they make $30,000, they get half as much vacation as other employees (only 5 days), and they have an additional method clean that prints Workin for the man. Make sure to interact with the superclass as appropriate.

Write a class called EmployeeTester.java that includes a main method. Create an array called lawFirm to hold 5 employee objects. Create one of each type of employee and store it in the array. You should have 5 objects created: an employee, janitor, a secretary, a legal secretary, and a lawyer. Write a for loop to print out all the employee objects and the number of vacation days for each employee. Separate the output for each employee with a blank line.

codes:

public class Employee { private String employeeID; private double salary; public Employee(String id, double sal) { employeeID = id; salary = sal; } public int getHours() { return 40; } public int getVacationDays() { return 10; } } 
public class Lawyer extends Employee { public Lawyer(String id, double sal) { super(id, sal); } public int getVacationDays() { return 15; } public void sue() { System.out.println("I'll see you in court!"); } } 

public class Secretary extends Employee { public Secretary(String id, double sal) { super(id, sal); } public void takeDictation(String text) { System.out.println("Dictating text: " + text); } } 

public class LegalSecretary extends Secretary { public LegalSecretary(String id, double sal) { super(id, sal); } public void fileLegalBriefs() { System.out.println("I could file all day!"); } } 

thank you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!