$25
This program represents a simple payroll system, which could hypothetically be used by a company to maintain information on their employees, departments, paychecks, etc. The system will be developed in several phases. This document describes the functionality to be implemented for phase I. The company’s payroll staff members would be using the system; from now on we will refer to these people as the “user”. For phase I, we are just going to implement several classes, but we are not going to implement a user interface. I am providing you with code for the PayrollSystem_Phase1 class, which is the class that has the main method. Important: All the classes that you implement are to provide a constructor with enough parameters to initialize all instance variables (some classes have an overloaded constructor, see the Notes for each class). Additionally, these classes need to provide a getter and a setter method for all instance variables, as well as a toString method that returns a String with the value of all the instance variables including labels. Employee – This class represents an employee. It implements the Payable interface. Private instance variables: employeeID of type String firstName of type String lastName of type String dateOfBirth of type String dateHired of type String accruedVacationHours of type double yearToDate of type double listOfPaychecks of type ArrayList Public Instance Methods: addPaycheck – This method doesn’t return a value and it has 1 parameter of type Paycheck. It adds the Paycheck parameter to the listOfPaychecks instance variable. calculateGrossAmount – This method has no parameters and returns a double value. It only returns 0. calculateTaxDeduction – This method has no parameters and returns a double value. It only returns 0. calculateVacationHours – This method has no parameters and returns a double value. It only returns 0. Notes: • This class has an overloaded constructor that doesn’t have parameters to initialize the accruedVacationHours, yearToDate, or listOfPaychecks instance variables. In this constructor, the accruedVacationHours and yearToDate instance variables are set to 0 and the listOfPaychecks instance variable is set to a new ArrayList of Paycheck elements. HourlyEmployee – This class extends the Employee class and it represents an employee that gets paid by the hour. Private instance variables: hourlyRate of type double periodHours of type double Public Instance Methods: calculateGrossAmount – this method overrides the implementation in the parent class, which only returns 0, while this one provides an actual calculation. The value that this method returns is the multiplication of the hourly rate times the number of hours. This is the gross amount that the hourly employee gets paid during a pay period. calculateTaxDeduction – this method overrides the implementation in the parent class, which only returns 0, while this one provides an actual calculation. The value that this method returns is the tax amount to be subtracted from the gross amount, which is calculated as a percentage of the gross amount. You are going to use the constants defined in the PayrollUtility class as follows: if the gross amount is less than the value of the THRESHOLD constant, you will use the value of the TAX_RATE_LESS_THAN_THRESHOLD constant as the percentage; else use the value of the TAX_RATE_THRESHOLD_OR_MORE constant as the percentage. Notes: • This class also has an overloaded constructor that doesn’t have parameters for accruedVacationHours, yearToDate, or listOfPayments. SalariedEmployee – This class extends the Employee class and it represents an employee that gets paid a salary. Private instance variables: annualSalary of type double Public Instance Methods: calculateGrossAmount – this method overrides the implementation in the parent class, which only returns 0, while this one provides an actual calculation. The value that this method returns is the division of the annual salary by the value of the NUMBER_OF_PAY_PERIODS constant defined in the PayrollUtility class. This is the gross amount the salaried employee gets paid during a pay period. calculateTaxDeduction – this method overrides the implementation in the parent class, which only returns 0, while this one provides an actual calculation. The value that this method returns is the tax amount to be subtracted from the gross amount and is calculated as a percentage of the gross amount. You are going to use the constants defined in the PayrollUtility class as follows: if the gross amount is less than the value of the THRESHOLD constant, you will use the value of the TAX_RATE_LESS_THAN_THRESHOLD constant as the percentage; else use the value of the TAX_RATE_THRESHOLD_OR_MORE constant as the percentage. calculateVacationHours – this method overrides the implementation in the parent class, which only returns 0, while this one provides an actual calculation. The value that this method returns is the number of vacation hours that the employee accrues during a pay period. You are going to use the constants defined in the PayrollUtility class as follows: if the gross amount is less than the value of the THRESHOLD constant, you will use the value of the VAC_HOURS_LESS_THAN_THRESHOLD constant as the value returned; else use the value of the VAC_HOURS_THRESHOLD_OR_MORE constant as the value returned. Notes: • This class also has an overloaded constructor that doesn’t have parameters for accruedVacationHours, yearToDate, or listOfPayments. Manager – This class extends the SalariedEmployee class and it represents a department’s manager. Private instance variables: weeklyBonus of type double Public Instance Methods: getBonusAfterTax – This method returns the bonus amount that the manager gets during a pay period after deducting taxes. Use the value of the BONUS_TAX_RATE constant defined in the PayrollUtility class. Notes: • This class also has an overloaded constructor that doesn’t have parameters for accruedVacationHours, yearToDate, or listOfPayments. • This class does not override the calculateGrossAmount, calculateTaxDeduction, or calculateVacationHours methods in the parent class. Paycheck – This class represents a single paycheck that an employee receives for a pay period. Private instance variables: employeeID of type String periodBeginDate of type String periodEndDate of type String payDate of type String grossAmount of type double taxAmount of type double bonusAmount of type double netAmount of type double Department – This class represents a department within the company. Private instance variables: departmentID of type String departmentName of type String departmentManager of type Manager listOfEmployees of type ArrayList Notes: • This class has an overloaded constructor that doesn’t have parameters to initialize the departmentManager or listOfEmployees instance variables. In this constructor, the listOfEmployees instance variable is set to a new ArrayList of Employee elements. Company – This class represents the company that is using this software. Private instance variables: companyName of type String departmentList of type ArrayList Public Instance Methods: generatePayroll – The signature for this method is as follows: public String generatePayroll(String beginDate, String endDate, String payDate) This method generates the payroll for all the employees in the company for the given pay period, start date, and end date. At the same time, it generates a String with all the payroll information and that is the String value that the method returns. Here is the algorithm you’ll follow to write the logic for this method: • Declare a String variable (I’ll call it output) where you’ll concatenate payroll information. • Loop through all the departments in the company’s departmentList. For every department: o Concatenate the department name and id to the output variable. o Get the department’s manager and concatenate the manager’s first, last name, gross pay, bonus, tax and net pay information to the output variable. o Create a Paycheck object with the manager’s information and add it to the manager. o Update the manager’s accrued vacation hours. o Update the manager’s yearToDate amount. o Get the list of employees for this department and for every employee: Concatenate the employee’s gross pay, tax and net pay information to the output variable. Create a Paycheck object with the employee’s information and add it to the employee. Update the employee’s accrued vacation hours. Update the employee’s yearToDate amount. • At the end (after the outer for loop), return the output variable.