Question
Manager class JAVA Implement a subclass of Employee, called Manager. A Manager ID number ranges from 2001 to 3000. A manager also has a group
Manager class JAVA
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.
class Employee1 { private String name; private int Id; private int age; private double salary; private String title; public Employee1(String tName, int tId, int tAge, double tSalary, String tTitle) { //super(); name = tName; Id = tId; age = tAge; salary = tSalary; title = tTitle; } 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 tName) { name = tName; } public void setId(int tId) { Id = tId; } public void setAge(int tAge) { age = tAge; } public void setSalary(double tSalary) { salary = tSalary; } public void setTitle(String tTitle) { title = tTitle; } public void changeSalary(double percentage) { salary=salary *(1+percentage/100); } 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