Package username
Class Hourly
java.lang.Object
username.Employee
username.Hourly
Represents an Hourly employee with an hourly rate and hours.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetHours()doublegetPay()Returns the gross pay of the Hourly Employee which is rate * hours.doublegetRate()protected StringReturns a String that breaks down the payment for the Hourly employee.voidsetHours(double hours) toString()Returns a String representation of the Hourly Employee.Methods inherited from class username.Employee
formatLine, generatePayStub, getId, totalDeductions
-
Constructor Details
-
Hourly
public Hourly(int id, String name, String address, double rate, List<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- List of Deductions for the Employee.- Throws:
IllegalArgumentException- if rate is less than or equal to 0.
-
-
Method Details
-
getHours
public double getHours() -
getRate
public double getRate() -
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:
paymentBreakdownin classEmployee- Returns:
- String that contains the hours, rate, gross pay, and net pay of the employee formatted nicely.
-