Provide another sub class ProfessionalCertification that extends Certification. This class no additional data member. o It overrides the calculateFee method so that the total cost is returned as the product of hours and cost per hour plus 15% tax of the total hours cost. o Also the ProfessionalCertification implements the Extendible Interface. You will also have to provide the implementation of method extend(int duration). For this you need to add the duration to the training hours of the certification The correctness of your code will be checked against a main program that will be provided along with the expected output
interface Extendible {
void extend(int duration);
}
class ProfessionalCertification extends Certification implements Extendible {
public ProfessionalCertification() {
}
public ProfessionalCertification(int Id, String name, int hours, String level, double costPerHr) {
super(Id, name, hours, level, costPerHr);
}
/**
* It overrides calculateFee method so that total cost is returned as product of
* hours and cost per hour plus 15% tax of total hours cost.
*/
@Override
public double calculateFee() {
double fee = super.calculateFee();
return fee + 0.15 * fee;
}
@Override
public void extend(int duration) {
setHours(getHours() + duration);
}
}
Comments
Leave a comment