Package solution
Class Hourly
java.lang.Object
solution.Employee
solution.Hourly
Represents an Hourly employee with an hourly rate and hours.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
getPay()
Returns the gross pay of the Hourly Employee which is rate * hours.protected String
Returns a String that breaks down the payment for the Hourly employee.void
setHours
(double hours) toString()
Returns a String representation of the Hourly Employee.Methods inherited from class solution.Employee
equals, formatLine, formatLine, generatePayStub, getId, totalDeductions
-
Constructor Details
-
Hourly
public Hourly(int id, String name, String address, double rate, ArrayList<Deduction> deductions) throws IllegalArgumentException Creates an Hourly Employee with an id, name, address, rate, and list of Deductions.- Parameters:
id
- ID of the employee.name
- Name of employee.address
- Address of the employee.rate
- Hourly rate of the employee.deductions
- ArrayList of Deductions for the Employee.- Throws:
IllegalArgumentException
- if rate is less than or equal to 0.
-
-
Method Details
-
setHours
public void setHours(double hours) -
getPay
public double getPay()Returns the gross pay of the Hourly Employee which is rate * hours. -
toString
Returns a String representation of the Hourly Employee. -
paymentBreakdown
Returns a String that breaks down the payment for the Hourly employee.- Specified by:
paymentBreakdown
in classEmployee
- Returns:
- String that contains the hours, rate, gross pay, and net pay of the employee formatted nicely. The net pay is the gross pay minus the total deductions amount.
-