Package solution

Class FullTime


public class FullTime extends Employee
Represents a full time Employee with a salary.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Number of pay periods in a year.
  • Constructor Summary

    Constructors
    Constructor
    Description
    FullTime(int id, String name, String address, double salary)
    Creates a FullTime Employee with an id, name, address, and salary.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the gross pay of the FullTime Employee which is the salary divided by the number of pay periods.
    protected String
    Returns a String that shows the payment breakdown for a FullTime employee with include their salary and gross pay.
    Returns a String that displays the Employee information which include the ID, name, address, type, and salary.

    Methods inherited from class solution.Employee

    equals, formatLine, formatLine, generatePayStub

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • NUM_PAY_PERIODS

      public static final int NUM_PAY_PERIODS
      Number of pay periods in a year.
      See Also:
  • Constructor Details

    • FullTime

      public FullTime(int id, String name, String address, double salary) throws IllegalArgumentException
      Creates a FullTime Employee with an id, name, address, and salary.
      Parameters:
      id - ID of the employee
      name - Name of employee
      address - Address of the employee
      salary - Yearly salary.
      Throws:
      IllegalArgumentException - if salary is less than or equal to zero.
  • Method Details

    • getPay

      public double getPay()
      Returns the gross pay of the FullTime Employee which is the salary divided by the number of pay periods.
      Specified by:
      getPay in class Employee
      Returns:
      Gross pay of the Employee.
    • toString

      public String toString()
      Returns a String that displays the Employee information which include the ID, name, address, type, and salary.
      Overrides:
      toString in class Employee
      Returns:
      String with Employee information.
    • paymentBreakdown

      protected String paymentBreakdown()
      Returns a String that shows the payment breakdown for a FullTime employee with include their salary and gross pay. The gross pay is obtained from getPay(). This should be formatted with formatLine.
      Specified by:
      paymentBreakdown in class Employee
      Returns:
      String that contains the salary and gross pay.