Part #5:

Testing your implementation of all the classes.

Write a program which tests implementation of your classes by computing weekly payroll for the company:

• Create a data structure to contain a week worth of shift data. Assume that the company is open 7 days a week and each day there are two 8 hour shifts.

• Initialize created data structure to contain a week worth of shift data. Use class Random to initialize the fields in the corresponding classes. It is a good idea is to re-use the code which creates an ArrayList of employees in part #3 to store all the employees who work for the company. You may want to make this ArrayList a bit larger than 20 entries. Once such an ArrayList is created you can use it to randomly retrieve employee data to populate the data structure which contains weekly shift information.

• Display the weekly shift data. For each shift display the following information: day, shift (i.e., day or night), names and position of employees who worked during that shift (i.e., production worker or shift supervisor), and whether the production goals were met during this shift

• Compute and display weekly payroll. When computing weekly payroll assume that:

o Night shift production workers, but not the supervisor, earn an extra 20% of their hourly rate. All production workers earn extra 5% percent of their total shift earnings if the production goals were met during their shift.

o The shift supervisor earns a weekly bonus if and only if his or her shift meets production goals 4 or more times a week. The weekly bonus is computed as percentage of weekly salary (assume 52 weeks per year) according to the number of years supervisor was working for the company:

• 0 - 5 years : bonus is 5% of weekly salary

• 6 – 10 years: bonus is 10% of weekly salary

• 11 – 20 years: bonus is 12% of weekly salary

• More than 20 years: bonus is 15% of weekly salary

To compute the payroll, first process the weekly shift data structure updating the weekly earnings for all the production employees and updating the number of times production goals were met for the shift supervisors. You may want to keep a separate data structure which contains information about all employees who were working for the company that week.

Next, you update weekly earnings for shift supervisors (you need to compute the number of times production goals are met that week before you can compute weekly salary for the shift supervisor) and compute the total payroll.

Finally, display all employees who worked for the company during that week (i.e., do not display employees who did not work that week), their weekly earnings, and the total amount of money the company paid to all of its employees that week.