{In Java Programming Please} Create a class hierarchy that represents different types of employees in a company. Start with a class called Employee that has two methods: calculateSalary() and displayDetails(). Then, create two subclasses of Employee: Manager and Engineer. Override the calculateSalary() method in both subclasses to calculate the salary based on their job role and experience. Override the displayDetails() method in both subclasses to print out a message indicating the details of the employee. Next, create another class called Salesperson that extends Employee and has a method called calculateCommission(). Create two subclasses of Salesperson: SeniorSalesperson and JuniorSalesperson. Override the calculateCommission() method in both subclasses to calculate the commission based on their sales performance. Override the displayDetails() method in both subclasses to print out a message indicating the details of the salesperson. In the main method, create objects of each class and call their respective methods to demonstrate polymorphism.
{In Java Programming Please}
Create a class hierarchy that represents different types of employees in a company. Start with a class called Employee that has two methods: calculateSalary() and displayDetails().
Then, create two subclasses of Employee: Manager and Engineer. Override the calculateSalary() method in both subclasses to calculate the salary based on their job role and experience. Override the displayDetails() method in both subclasses to print out a message indicating the details of the employee.
Next, create another class called Salesperson that extends Employee and has a method called calculateCommission().
Create two subclasses of Salesperson: SeniorSalesperson and JuniorSalesperson. Override the calculateCommission() method in both subclasses to calculate the commission based on their sales performance. Override the displayDetails() method in both subclasses to print out a message indicating the details of the salesperson.
In the main method, create objects of each class and call their respective methods to demonstrate polymorphism.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images