Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You are required to create a program that will require the following interface a

ID: 3581246 • Letter: Y

Question

You are required to create a program that will require the following interface and classes:

An interface called Compensation that lists the following methods:

A method called getSalaryBeforeTaxes. This method takes in an argument called daysWorked ( of type double,). This method tells how many days an employee actually works in a month. This method returns a double variable that represents the salary earned by the employee before taking off the taxes. This method is implemented in the Employee class.

A method called getSalaryAfterTaxes that takes in an argument called daysWorked, of type double. This method tells how many days an employee actually worked in a month. This method returns a double variable that represents the salary earned by the employee after taxes. This method is implemented in the Employee class.

A method called getTaxRate that takes as an argument, the employee’s tax status, which is an argument of type integer. This method returns the tax rate, which is a decimal less than 1. This methods is also implemented in the Employee class.

An Employee class that stores an employee’s information such as first name, last name, employee ID, daily work hours, hourly pay rate and tax status.

Instance variables are as given below. All of them have to be declared private

First name and last name are String data types

Employee ID is a 6 digit alphanumeric character (eg C23456).

Tax status is an integer of value 1 ,2,3,4,5 and any values greater than 5, that will indicate the tax bracket identifier of an employee.

Daily work hours and hourly pay rate are both of double data type.

Methods required:

Getters and Setters for all the six instance variables.

Implementation of methods listed in the Compensation interface:

getSalaryBeforeTaxes , which returns salary = daily work hours * hourly pay rate * days worked in a month.

getSalaryAfterTaxes: which returns salary = daily work hours * hourly pay rate* days worked*(1- tax rate). Tax rate is calculated using the getTaxRate method.

getTaxRate : return the tax rate for a given status using the following condition:

    status

Tax rate

1

0.1

2

0.15

3

0.2

4

0.28

5

0.33

6

0.35

You may add any additional variables / methods as required for the program.

A tester class called TestEmployee that does the following in its main method:

Create a new Array List called myList1 that stores objects of the type Employee.

Insert each Employee object element with the following values, into the array list

First name

Last name

Employee ID

Daily hours worked

Hourly pay rate

Tax status

John

Doe

C23456

8

25.0

2

Mary

Jones

C34587

10

15.0

2

Ricky

Rames

C98123

6

50.0

3

Liam

Nielsen

C56723

9

75.0

4

Celina

Withers

C98145

4

28.0

2

Print the following in the console on a separate line to make your results easier to read on the console: “******Employee Report******”

Traverse through myList1 using a ListIterator object and print out the following :

Number of employees,

Average hourly pay (total of all hourly pay rate for all the employees divided by the total number of employees in the list) and

Average daily hours worked (total of all the daily hours worked divided by the number of employees in the list.

Total salary before taxes for all employees for daysWorked = 24

Total salary after taxes for all employees for daysWorked = 24

Print the following in the console on a separate line to make it easier to read your results: “ *******Queries*******”

Print the following in the console on a separate line : “Employee whose tax status is equal to 2: ”

Traverse through the array and print on a separate line for each employee:   the employee IDs of all employees who falls under the tax status equal to 2.

Print out the following in the console on a separate line : “******Filter data ***********”

Create a new ArrayList object called filter1.

Traverse through the ArrayList myList1 and check for all elements whose hourly pay rate is less than 30. Add these elements one by one, to Array List filter1.

Then, traverse through the filter1 array list and for each element of filter1 increase the hourly pay of each employee by 10 and print out the employee Id of this employee along with the new pay rate.

Hint: while traversing through a list , you may need to print different types of data for a given object. Every time you use .next(), your iterator moves forward by one step.So if you want to pull out, say the pay rate and status of the same employee, you cannot use next() more than once. How then will you pull out multiple data for the same object without the list iterator moving forward? To do this, please use a reference variable for an Employee object that will point to the element / object returned by the next() of the list iterator object. Use this reference variable to access the Employee object’s data.

    status

Tax rate

1

0.1

2

0.15

3

0.2

4

0.28

5

0.33

6

0.35

Explanation / Answer

Employee.java

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote