Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What role does advertising play in our economic system?

Answered: 1 week ago