Question
plz use the code below java Manager class Implement a subclass of Employee, called Manager. A Manager ID number ranges from 2001 to 3000. A
plz use the code below java
Manager class
Implement a subclass of Employee, called Manager. A Manager ID number ranges from 2001 to 3000. A manager also has a group of employees that he/she supervises found in an ArrayList called managedEmployees. For managedEmployees
- Provide a mutator which adds an Employee (an input parameter reference) to the managedEmployees list.
- Provide an method called getManagedEmployeesListSize which returns the size of the managedEmployees list.
- Provide a method called getManagedEmployee with an input parameter I which returns a reference to the Employee at index I in the managedEmployees list.
- Override toString(). All you need to do is change the word employee to manager. No new variables here.
Executive class
Implement a subclass called Executive. Executive extends Manager, but an Executive only supervises an Employee who is a manager An Executive ID number ranges from 3001 to 3500.
Create an additional instance variable of type double called totalComp for an Executive which may be initialized to 0.0.
Add a mutator method called setTotalComp with the companys profits and the bonus percentage as input values, which calculates and sets the total compensation of salary plus bonus as a double. An executive gets a bonus at the end of each year equal to a percentage of company profits.
Also include a getTotalComp() method which returns the totalComp. Modify the toString() method to include the totalComp.
Override toString to include the totalComp for the Executive. Also change the word in the printout from manager to executive.
class Employee{ private String name; private int Id; private int age; private double salary; private String title; public Employee(String aName, int aId, int aAge, double aSalary, String aTitle) { super(); name = aName; Id = aId; age = aAge; salary = aSalary; title = aTitle; } public void changeSalary(double percentage) { salary=salary *(1+percentage/100); } public String getName() { return name; } public int getId() { return Id; } public int getAge() { return age; } public double getSalary() { return salary; } public String getTitle() { return title; } public void setName(String aName) { name = aName; } public void setId(int aId) { Id = aId; } public void setAge(int aAge) { age = aAge; } public void setSalary(double aSalary) { salary = aSalary; } public void setTitle(String aTitle) { title = aTitle; } @Override public String toString() { return "Employee [name=" + name + ", Id=" + Id + ", age=" + age + ", salary=" + salary + ", title=" + title + "]"; }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started