Answered You can hire a professional tutor to get the answer.

QUESTION

Use the following class descriptions to write the abstract super class Employee , and two of its subclasses, HourlyEmployee and SalariedEmployee I.

Use the following class descriptions to write the abstract super class Employee, and two of its subclasses, HourlyEmployee and SalariedEmployee

I. Write an abstract superclass encapsulating an Employee:

The Employee class has an attribute representing the employee name and three methods:  an “overloaded” constructor which takes the employee name as a parameter, a toString() method that returns a message including the employee name, and an abstract method called earnings() which will be implemented in your subclasses.

II. Write a non-abstract subclass that inherits from the Employee class encapsulating a salaried employee:

The SalariedEmployee class has one attribute representing the salary amount received. It has three methods: an “overloaded” constructor which takes the name and payment amount as a parameter, a toString() method that prints a message including the employee name, and the salary amount, and an non-abstract method called earnings() which returns the salary of the employee.

III. Write a non-abstract subclass that inherits from the Employee class encapsulating an hourly worker:

The HourlyEmployee class has two attributes representing the hours and the pay rate of the employee. It has three methods: an “overloaded constructor which takes the name, hours and rate as parameters”, a toString() method that prints a message including the employee name and the hours and rate, and an non-abstract method called earnings() which returns the gross pay as regular hours (hours times rate) for all employees working 40 hours or less, or overtime pay which is regular hours plus time-and-a-half for any overtime hours worked.

IV. Write a client program that declares and populates an ArrayList or an array of objects ( of type Employee) referencing SalariedEmployee or HourlyEmployee objects, then in a loop print each of the elements by calling your toString() method followed by the earnings() method. Use the following data and output as a guide:

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question