Package solution

Class PayrollGenerator

java.lang.Object
solution.PayrollGenerator

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

    • PayrollGenerator

      public PayrollGenerator()
  • Method Details

    • parseEmployee

      public static Employee parseEmployee(Scanner in)
      Creates and returns a new Employee (FullTime or Hourly) based on the next line queued in the passed-in Scanner. Each line in the Scanner is an entry containing information for an Employee. If an exception is generated while parsing the line or creating an Employee, that exception should not be caught in this method, but be allowed to propagate to the method that called it.
      Parameters:
      in - Scanner queue with lines containing Employee information.
      Returns:
      New Employee based on the next line in the Scanner.
      Throws:
      IllegalArgumentException - If the type in the Employee entry is neither fulltime nor hourly.
    • readStaffList

      public static ArrayList<Employee> readStaffList(Scanner in)
      Asks the user for Employee information and returns a list of Employee objects created from that information. The information for each Employee should be entered as a single line of attributes of the form id: name: address: type: value1: value2. If there is an error parsing an entry, an error message should be displayed and that entry is skipped. After each entry, the user should be asked if they want to enter another entry.
      Parameters:
      in - Scanner to get user input.
      Returns:
      ArrayList of Employees generated from the user input.
    • main

      public static void main(String[] args)
      Uses the readStaffList() method to create a list of Employee objects and then calls the generatePayStub() method for each Employee in the list. The Scanner passed into readStaffList(), should be a Scanner made from System.in.
      Parameters:
      args - Not used.