This commit is contained in:
louiscklaw
2025-01-31 19:15:17 +08:00
parent 09adae8c8e
commit 6c60a73f30
1546 changed files with 286918 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
public class PartTimeStaff extends Staff implements Salary {
private int workingHour;
public PartTimeStaff(String name, int id, char grade, int workingHour) {
super(name, id, grade);
this.workingHour = workingHour;
}
public void display() {
System.out.println("Name: " + name + "; ID: " + id + "; Grade: " + grade + "; Working Hour: " + workingHour + "; Salary: " + computeSalary());
}
public int computeSalary() {
switch (grade) {
case 'A':
return SALARY_A;
case 'B':
return SALARY_B;
case 'C':
return SALARY_C;
default:
return SALARY_OTHER;
}
}
}