Question
please use the code below JAVA Implement a subclass called Executive. Executive extends Manager, but an Executive only supervises an Employee who is a manager
please use the code below JAVA 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.
import java.util.ArrayList; public class Manager { private String name; private int age; private double salary; private String title; private int managerId; private ArrayList
........................................................
public class Employee { private String name; private int Id; private int age; private double salary; private String title; public Employee(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