JAVA) Create a class hierarchy to represent the different types of employees in an office who have the following job titles: manager, assistant, salesperson. Write an abstract base class called Employee that declares an abstract method: signature double calculateSalary() This class must also define the following attributes: name (String type), enrollment (String type) and base_salary (double type). Use encapsulation and provide a constructor that receives the corresponding values ​​to be stored in the respective attributes. This abstract class must be extended by the other classes representing the types of employees, so the classes Manager, Assistant and Salesperson must be written. In each class you must override the method calculateSalario so that the salary calculation is done like this: The manager receives twice the base_salary, the assistant receives the base_salary and the salesperson receives the base_salary plus a commission defined in the constructor of his class. Create a Main class with a main method that creates an object of each type and stores them in a list, then calculates the payroll for the three employees and prints the total amount. Indicate which POO concepts you used and how they were used.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter13: Overloading And Templates
Section: Chapter Questions
Problem 32SA
icon
Related questions
Question

(JAVA)

Create a class hierarchy to represent the different types of employees in an office who have the following job titles: manager, assistant, salesperson. Write an abstract base class called Employee that declares an abstract method:

signature double calculateSalary()

This class must also define the following attributes: name (String type), enrollment (String type) and base_salary (double type).

Use encapsulation and provide a constructor that receives the corresponding values ​​to be stored in the respective attributes. This abstract class must be extended by the other classes representing the types of employees, so the classes Manager, Assistant and Salesperson must be written. In each class you must override the method calculateSalario so that the salary calculation is done like this: The manager receives twice the base_salary, the assistant receives the base_salary and the salesperson receives the base_salary plus a commission defined in the constructor of his class.

Create a Main class with a main method that creates an object of each type and stores them in a list, then calculates the payroll for the three employees and prints the total amount. Indicate which POO concepts you used and how they were used.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning