Class HourlyEmployee
- java.lang.Object
-
- HourlyEmployee
-
- All Implemented Interfaces:
Employee
- Direct Known Subclasses:
PartTimeEmployee
public class HourlyEmployee extends java.lang.Object implements Employee
A representation of an hourly employee, which will keep track of their hours in order to be able to calcuate their current expected pay
-
-
Constructor Summary
Constructors Constructor Description HourlyEmployee(java.lang.String name, java.lang.String title, int id, double wage)
Create an Hourly Employee with the following infomation and setting the shift to "day"HourlyEmployee(java.lang.String name, java.lang.String title, int id, double wage, java.lang.String shift)
Create an Hourly Employee with the following infomation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHours(double hours)
Add the appropriate hours to their time carddouble
pay(double taxRate)
Process the hours that they have worked, returning the pay amount ((Hours worked * rate) * (1 - tax rate)) and resetting the hours to zerovoid
setShift(java.lang.String shift)
Set their work shiftjava.lang.String
toString()
How to display the employee
-
-
-
Constructor Detail
-
HourlyEmployee
public HourlyEmployee(java.lang.String name, java.lang.String title, int id, double wage)
Create an Hourly Employee with the following infomation and setting the shift to "day"- Parameters:
name
- Their name representing the persontitle
- Their title or job descriptionid
- Their employee id numberwage
- Their starting hourly wage
-
HourlyEmployee
public HourlyEmployee(java.lang.String name, java.lang.String title, int id, double wage, java.lang.String shift)
Create an Hourly Employee with the following infomation- Parameters:
name
- Their name representing the persontitle
- Their title or job descriptionid
- Their employee id numberwage
- Their starting hourly wageshift
- What shift will they be working
-
-
Method Detail
-
toString
public java.lang.String toString()
How to display the employee
-
pay
public double pay(double taxRate)
Process the hours that they have worked, returning the pay amount ((Hours worked * rate) * (1 - tax rate)) and resetting the hours to zero
-
addHours
public void addHours(double hours)
Add the appropriate hours to their time card- Parameters:
hours
- hours to add to their total
-
setShift
public void setShift(java.lang.String shift)
Set their work shift- Parameters:
shift
- the shift they are going to be working
-
-