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.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
(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.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images