package Employee;
public class HEmployee extends Employee {
private int hours;
private double wage;
public HEmployee(String name, String id,int hours,double wage) {
super(name, id);
this.setHours(hours);
this.setWage(wage);
// TODO Auto-generated constructor stub
}
@Override
public double earning() {
// TODO Auto-generated method stub
if(this.getHours()<=30)
return this.getHours*30.0;
else
return 30*30+(this.getHours()-30)*1.5*30;
}
public int getHours() {
return hours;
}
public void setHours(int hours) {
this.hours = hours;
}
public double getWage() {
return wage;
}
public void setWage(double wage) {
this.wage = wage;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return super.toString()+"\n钟点工:"+this.earning();
}
}