Question: Exercises 1. Create the classes in the following inheritance hierarchy. An Employee should have a first name, last name and ID number. In addition, the

Exercises 1. Create the classes in the following inheritance hierarchy. An Employee should have a first name, last name and ID number. In addition, the SalariedEmployee should have a weekly salary; an HourlyEmplovee should have a wage and a number of hours worked; a CommissionEmplovee should have a commission rate and gross sales; and a BaseCommissionEmployee should have a base salary. Each class should have an appropriate constructor, setters and getters. Each Employee should have an earning() and toString () methods. Also make Employee comparable. The compareTo method compares between the employees based on earnings. - Write a method that finds the total earnings of all the employees in an array. The method signature is: public static double totalEarning (Employee [] a) - Write another method that sorts an array of Objects using the compareTo method. The signature of this method is: public static void sort(Object [] a) - Write a test program that creates an array of 5 employees and computes their total earnings using the totalEarning method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
