Question: I need help with steps 1 & 2 in JAVA script of the WorkerDemo, a demo of the ProductionWorker program. import java.text.DecimalFormat; public class ProductionWorker
I need help with steps 1 & 2 in JAVA script of the WorkerDemo, a demo of the ProductionWorker program.
import java.text.DecimalFormat;
public class ProductionWorker extends Employee
{
public static final int DAY_SHIFT = 1;
public static final int NIGHT_SHIFT = 2;
private int shift;
private double payRate;
public ProductionWorker(String n, String num, String date, int s, double p)
{
super(n, num, date);
shift=s;
payRate=p;
}
public ProductionWorker()
{
super();
shift=1;
payRate=0.0;
}
public void setShift(int s)
{
shift=s;
}
public int getShift()
{
return shift;
}
public void setPayRate(double p)
{
payRate = p;
}
public double getPayRate()
{
return payRate;
}
public String toString()
{
String str=super.toString();
str+=" Shift: "+ shift +" Pay Rate: "+ payRate;
return str;
}
}
public class WorkerDemo
{
public static void main(String[] args)
{
String shift; // To hold a shift value
//step1: Create a ProductionWorker object and pass the following initialization
// data to the constructor, name "John Smith", hire Date is 11-05-2005, number is 123-5, day shift is 1,
// pay rate is 16.5.
//step2: Display the data by using toString method.
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
