Package solution
Class FullTime
java.lang.Object
solution.Employee
solution.FullTime
Represents a full time Employee with a salary.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Number of pay periods in a year. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
getPay()
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.toString()
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
-
Field Details
-
NUM_PAY_PERIODS
public static final int NUM_PAY_PERIODSNumber of pay periods in a year.- See Also:
-
-
Constructor Details
-
FullTime
Creates a FullTime Employee with an id, name, address, and salary.- Parameters:
id
- ID of the employeename
- Name of employeeaddress
- Address of the employeesalary
- 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. -
toString
Returns a String that displays the Employee information which include the ID, name, address, type, and salary. -
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 classEmployee
- Returns:
- String that contains the salary and gross pay.
-