Package solution
Class PayrollGenerator
java.lang.Object
solution.PayrollGenerator
Generates the payroll for a company.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Number of days between the start and end of the pay period. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double
Gets the number of hours in the timesheet file between the start (inclusive) and end dates (exclusive).static void
readStaffList
(String filename) Creates an ArrayList of Employees from the provided staff list.
-
Field Details
-
PAY_PERIOD_LENGTH
public static final int PAY_PERIOD_LENGTHNumber 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
-