Question: package ex 1 inheritance; / * * * * @author athee * / public class Ex 1 Inheritance { public static void main ( String
package exinheritance;
@author athee
public class ExInheritance
public static void mainString args
ProductionWorker workerOne new ProductionWorkerJohn Smith", A;
ProductionWorker workerTwo new ProductionWorkerJoan Jones", L;
System.out.printlnHeres the first production worker:
workerOne;
System.out.println
Here's the second production worker:
workerTwo;
public class Employee
private String name;
private String employeeNumber;
private String hireDate;
public EmployeeString name, String employeeNumber, String hireDate
this.name name;
this.employeeNumber employeeNumber;
this.hireDate hireDate;
public String getName
return name;
public void setNameString name
this.name name;
public String getEmployeeNumber
return employeeNumber;
public void setEmployeeNumberString employeeNumber
this.employeeNumber employeeNumber;
public String getHireDate
return hireDate;
public void setHireDateString hireDate
this.hireDate hireDate;
public class ProductionWorker extends Employee
private int shift;
private double payRate;
public ProductionWorkerString name, String employeeNumber, String hireDate, int shift, double payRate
supername employeeNumber, hireDate;
this.shift shift;
this.payRate payRate;
public int getShift
return shift;
public void setShiftint shift
this.shift shift;
public double getPayRate
return payRate;
public void setPayRatedouble payRate
this.payRate payRate;
@Override
public String toString
String shiftType shift "day" : "night";
return "Name: getName
Employee Number: getEmployeeNumber
Hire Date: getHireDate
Shift: shiftType
Hourly Pay Rate: $ payRate;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
