Professional Documents
Culture Documents
Prova Av2
Prova Av2
java
Main:
basePlusCommissionEmployee.earnings());
employees[0] = salariedEmployee;
employees[1] = hourlyEmployee;
employees[2] = commissionEmployee;
employees[3] = basePlusCommissionEmployee;
System.out.println(currentEmployee);
employee.setBaseSalary(1.10 * employee.getBaseSalary());
Employee:
public abstract class Employee
this.firstName = firstName;
this.lastName = lastName;
this.socialSecurityNumber = socialSecurityNumber;
return firstName;
return lastName;
return socialSecurityNumber;
}
@Override
Comission employee:
throw new IllegalArgumentException("Commission rate must be > 0.0 and < 1.0");
this.commissionRate = commissionRate;
this.grossSales = grossSales;
return grossSales;
throw new IllegalArgumentException("Commission rate must be > 0.0 and < 1.0");
this.commissionRate = commissionRate;
return commissionRate;
}
@Override
@Override
this.baseSalary = baseSalary;
this.baseSalary = baseSalary;
return baseSalary;
@Override
@Override
}
}
Hourly employee:
throw new IllegalArgumentException("Hours worked must be >= 0.0 and <= 168.0");
this.wage = wage;
this.hours = hours;
this.wage = wage;
return wage;
throw new IllegalArgumentException("Hours worked must be >= 0.0 and <= 168.0");
this.hours = hours;
return hours;
@Override
else
}
@Override
Salaried employee:
this.weeklySalary = weeklySalary;
this.weeklySalary = weeklySalary;
}
public double getWeeklySalary(){
return weeklySalary;
@Override
return getWeeklySalary();
@Override