Files
004_comission/_resources/it114105/itp3914/Lab12/Ex5/PartTimer.java
louiscklaw 6c60a73f30 update,
2025-01-31 19:15:17 +08:00

22 lines
665 B
Java

public class PartTimer extends Employee5 {
protected int workingHour;
protected int hourlyRate;
PartTimer(String name, int employeeID, int workingHour, int hourlyRate){
super(name, employeeID);
this.workingHour = (workingHour > 220) ? 0: workingHour;
this.hourlyRate = hourlyRate;
calculateSalary();
}
protected void calculateSalary(){
salary = workingHour * hourlyRate;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return super.toString() + ", Salary: " + salary + ", working Hour: " + workingHour + ", Hourly rate: " + hourlyRate;
}
}