Question: Problem: With Java For this lab, you will implement the following class hierarchy: You must follow the following rules: Employee is an abstract class which

Problem:

With Java

For this lab, you will implement the following class hierarchy:

Problem: With Java For this lab, you will implement the following class

You must follow the following rules:

Employee is an abstract class which keeps track of the Employees company, first name, and last name. It also has a toString() method that prints the users name and company. It also has two abstract methods: double getPay() and String determineBenefits()

Employee should ALSO have a protected DecimalFormat object set to use the format string ($##.##). Use this to format all numeric output.

HourlyEmployee adds wages and hours as a double and int. It implements determineBenefits, giving the employee benefits only if their hours are >= 40.

Page is wage * hours if hours

The toString, shown below, includes the weekly pay.

ContractEmployee adds a contract fee as a double that is an additional amount of money paid out. It does not need its own toString, but does need a getPay method which is simply hours * wages + contractFee. ContractEmployees dont get benefits.

SalaryEmployee adds a salary. getPay returns the salary. SalaryEmployees get standard benefits and need their own toString.

Finally, implement a menu. The menu should have the main method. The menu should store all Employees in an ArrayList object, using polymorphism to keep track of Hourly, Salary, and Contract employees in the same list. The menu is responsible for the four options shown in the menu below. Those options are:

Adding a new Employee, which requires all the fields for the new Employee to be provided. Note that you will have to ask the user if they are adding an Hourly, Salary, or Contract employee so you know what fields to ask for!

Listing Employees, which means printing out all the Employees in the ArrayList

Printing the benefit status of all Employees in the ArrayList

Exiting the application

Sample Output:

Note the below does not show an implementation for 1). 1) is left for you guys!

Please select an option:

1) Add an Employee

2) List Employees

3) List Benefit Status

4) Quit

2

Bob Johnson from IPFW. This worker's pay this week was $150.00.

Rob Strongbuff from Musclemasters. This worker's pay this week was $465.00.

Jim Jimson from Aptera. This worker's pay this week was $1100.00.

Harvey Deskman from Musclemasters. This worker's salary is $85000.00.

Please select an option:

1) Add an Employee

2) List Employees

3) List Benefit Status

4) Quit

3

Bob Johnson: No benefits

Rob Strongbuff: This worker gets benefits!

Jim Jimson: Contract workers get no benefits.

Harvey Deskman: This employee has a standard company health insurance policy.

Please select an option:

1) Add an Employee

2) List Employees

3) List Benefit Status

4) Quit

4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!