Package solution

Class PayrollGenerator

java.lang.Object
solution.PayrollGenerator

public class PayrollGenerator extends Object
Generates the payroll for a company.
  • Field Details

    • PAY_PERIOD_LENGTH

      public static final int PAY_PERIOD_LENGTH
      Number of days between the start and end of the pay period.
      See Also:
  • Constructor Details

    • PayrollGenerator

      public PayrollGenerator()
  • Method Details

    • getHours

      public static double getHours(String filename, LocalDate periodStart, LocalDate periodEnd) throws FileNotFoundException, IllegalArgumentException
      Gets the number of hours in the timesheet file between the start (inclusive) and end dates (exclusive). If an error occurs while reading a line from the timesheet, that line should be skipped.
      Parameters:
      filename - Filename for the timesheet.
      periodStart - Start date.
      periodEnd - End date.
      Returns:
      Hours worked between the start and end dates.
      Throws:
      FileNotFoundException - If the timesheet file can not be opened.
      IllegalArgumentException - If the filename does not end with .csv
    • readStaffList

      public static List<Employee> readStaffList(String filename) throws FileNotFoundException, IllegalArgumentException
      Creates an ArrayList of Employees from the provided staff list. If an error occurs parsing an Employee element, skip that element.
      Parameters:
      filename - String for the filename for the staff file.
      Returns:
      ArrayList of Employees generated from the staff list.
      Throws:
      FileNotFoundException - If the file can not be opened.
      IllegalArgumentException - If the filename entered does not have the .xml extension.
    • main

      public static void main(String[] args)