update,
This commit is contained in:
30
_resources/it114105/itp4510/Lab01/Lab1.1/HourlyWorker.java
Normal file
30
_resources/it114105/itp4510/Lab01/Lab1.1/HourlyWorker.java
Normal file
@@ -0,0 +1,30 @@
|
||||
public class HourlyWorker extends Worker {
|
||||
private double wage;
|
||||
private double hours;
|
||||
|
||||
public HourlyWorker(String name, double w, double h) {
|
||||
super(name);
|
||||
setWage(w);
|
||||
setHours(h);
|
||||
}
|
||||
|
||||
public void setWage(double w) {
|
||||
wage = w;
|
||||
}
|
||||
|
||||
public void setHours(double h) {
|
||||
hours = h;
|
||||
}
|
||||
|
||||
public double earnings() {
|
||||
salary = wage * hours;
|
||||
return salary;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return super.toString() + " earned $" + earnings() +
|
||||
|
||||
" for " + hours + " hours";
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user