CM16 Final Project - Payroll using file

FINAL PROJECT:   Payroll Program using employee data file.

Using your previous interactive payroll projects as a baseline (and re-using functions and declarations as much as possible), create a modified payroll program which first reads the employee data (id, code, dependents, lastname, firstname) from a disk file and then interactively accepts input about employee hours (by ID, in any order). After all of the hourly data has been input by the Payroll Clerk (user), your program should then print all of the paychecks in ID order (skipping any where the pay is zero). Finally, print statistics about the entire payroll (see below).


Using Java, create an Employee object (class) to hold the following private data for one employee:

Add "get" and "set" methods as needed, but do NOT allow the last three fields to be set.
Also add the following method:

SPECIFICATIONS for main()

PURPOSE:  Perform weekly payroll processing for a small business.

DESCRIPTION:   Obtain pay rate and other employee data from a disk file and hours from keyboard input, then print paychecks and statistics.

Get your program working with a linear search function to lookup the ID.
For extra credit, to sort the arrays by ID, and then replace the lookup function with a binary search.


INPUT

FILE INPUT:   Assume there is a personnel data file containing the following information record for each employee:

id Employee ID number
code 1 if eligible for overtime; else 2 or 3.
married (true or false)
dependents Number of dependents
rate Pay rate per hour
last Last name
first First name
middle Middle name
All ID numbers are greater than zero. You may assume that name strings contain no blanks or punctuation (or that each string is surrounded by quotes).
After the last employee data record, there is an additional dummy record with an ID number of zero.

KEYBOARD INPUT:   The user will input an ID number and the number of hours worked. Provide appropriate prompt messages, and an error message if there is no such ID. ID numbers (with hours) may be entered in any order. (It is possible that some employees did not work this week.   It is also possible for the clerk to input an invalid ID #; decide how to deal with it.)
An ID number of zero indicates the end of keyboard input.


OUTPUT:  

1. Print a (simulated) paycheck for each employee who worked this week (pay greater than zero). Each paycheck should show the following:

2. After all paychecks are printed, display the following statistics:

Display a list of all employees, from highest-paid to lowest-paid.
Next, display a list of (all) employee last names and net pay amounts, from highest-paid to lowest-paid, for all married employees who worked more than 45 hours this week. (The boss wants to send flowers.)

3. Finally, give everybody a 10% raise, with a minimum of one dollar-per-hour. (Do not add this code to the main routine;   instead, write a separate function named "raise()", and call it from "main".)



PROGRAM DESIGN

Your program should have a simple main( String[] args ) function that calls the following functions (where a is the array of Employee objects, and m is the number of used:



CALCULATIONS

Pay codes are either 1 or 2 or 3, with pay amounts calculated as follows:

  1. OVERTIME: If pay code is 1, then pay time-and-a-half for hours over 40.
  2. EXEMPT: If pay code is 2, all hours worked are paid at straight-time.
  3. MANAGER: If pay code is 3, pay 40 hours (and use 40 hours in statistics), regardless of hours reported.

Taxes: