Scenario: You are modeling different types of employees at a company.
Employee, with an abstract method calculatePay() and toString()HourlyEmployee that extends Employee with an instance variable hourlyRate and an implementation of calculatePay() that returns hoursWorked * hourlyRateSalariedEmployee that extends Employee with an instance variable annualSalary and an implementation of calculatePay() that returns annualSalary / 52 (weekly pay)public abstract class Employee {
protected String firstName;
protected String lastName;
protected String employeeID;
abstract double calculatePay();
abstract void setName(String first, String last);
@Override
public String toString() {
String out = "Employee ID: " + employeeID;
out += "\nEmployee Name: " + firstName + " " + lastName;
out += "\nSalary: " + calculatePay();
return out;
}
}public class HourlyEmployee extends Employee{
private double hourlyRate;
private double hoursWorked;
public HourlyEmployee(double rate, String ID) {
hourlyRate = rate;
super.employeeID = ID;
}
public void setName(String first, String last) {
super.firstName = first;
super.lastName = last;
}
public void addHours(double hours) {
hoursWorked += hours;
}
public double calculatePay() {
return Math.round(hourlyRate * hoursWorked * 100) / 100.0;
}
}Employee directly?HourlyEmployee did not implement calculatePay()?A continuum of detail…