Need help with this programming assignment. Needs to be completed in Java. thank
ID: 3693455 • Letter: N
Question
Need help with this programming assignment. Needs to be completed in Java. thank you.
Design a class named Employee. The class should keep the following information in fields: employee name employee number in the format XXXL where each X is a digit within the range 0-9 and L is a letter in the range A-M month, day and year of hire Write one or more constructors and the appropriate accessor and mutator methods for the class Write a runner class to check that the above works Write a class named ProductionWorker that extends the Employee class. The ProductionWorker class should have fields to hold the following infromation: Shift (an integer) Hourly pay rate (a double) The workday is divided into two shifts: day and night. The shift field will be an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write one or more constructors and the appropriate accessor and mutator methods for the class. Add code to the runner program to show that this sub class works A shift supervisor is a salaried employee (not paid by the hour), who supervises a shift. In addition to a salary, the supervisor earns a yearly bonus when his/her shift meets production goals. Design a the ShiftSupervisor class that extends the employee class. The ShiftSupervisor class should have a field that holds the annual salary and a field that holds the annual production bonus that a supervisor has earned. Write one or more constructors and the appropriate accessor and mutator methods for this class. Add to the runner program to show this class works A team leader is an hourly paid production worker that leads a small team. In addition to hourly pay. team leaders earn a fixed monthly bonus. Team leaders are required to attend a minimum number of hours of training per year. Design a TeamLeader class that extends the ProductionWorker class. The TeamLeader class should have fields for the monthly bonus amount, the required number of training hours and the number of training hours that the team leader has attended. Write one or more constructors and the appropriate accessor and mutator methods for this class. Add to the runner program to show this class worksExplanation / Answer
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class Runner {
public static void main(String[] args) throws IOException {
Employee emp=new Employee();
emp.setEmpNNeme();
emp.setDate();
emp.setEmpNo();
System.out.println("Employee details are, Name:" + emp.getEmpNNeme() +" DoJ: "+emp.getDate()+" Emp no: "+emp.getEmpNo());
// ProductionWorker pw=new ProductionWorker();
// pw.setEmpNNeme();
// pw.setDate();
// pw.setEmpNo();
// pw.setHourlyPay();
// pw.setShift();
// pw.getEmpNNeme();
// pw.getDate();
// pw.getEmpNo();
// pw.getHourlyPay();
// pw.getShift();
//Please write for team lead and superwiser. It works.
}
}
class Employee {
String empNNeme;
String empNo=null;
Date date;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public String getEmpNNeme() {
return empNNeme;
}
public void setEmpNNeme() throws IOException {
System.out.println("Enter the Employee name");
this.empNNeme =br.readLine();
}
public String getEmpNo() {
return empNo;
}
public void setEmpNo() throws IOException {
System.out.println("Enter the employee Number XXXL");
this.empNo = br.readLine();
Character c= empNo.charAt(0);
if(Character.isDigit(c)){
System.out.println(c+ " is digit");
}else{
System.out.println(c+ " is letter");
}
}
public Date getDate() {
return this.date;
}
public void setDate() throws IOException {
System.out.println("Enter data of joining in the for yyyy-MM-dd");
String dateStr = br.readLine();
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd");
try {
this.date = sdf.parse( dateStr.replaceAll(":(?=..$)", ""));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
class ProductionWorker extends Employee{
int shift;
double hourlyPay;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
public ProductionWorker() {
// TODO Auto-generated constructor stub
this.shift=1;
this.hourlyPay=5000.00; //setting the default values.
}
public int getShift() {
return shift;
}
public void setShift() throws NumberFormatException, IOException {
System.out.println("enter the shift");
this.shift=Integer.parseInt(br.readLine());
}
public double getHourlyPay() {
return hourlyPay;
}
public void setHourlyPay() throws NumberFormatException, IOException {
System.out.println("Enter Hourly payment");
this.hourlyPay=Double.parseDouble(br.readLine());
}
}
class Superwiser{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Double annualProdBonus;
Superwiser(){
this.annualProdBonus=9000.00; //Setting the default value
}
public Double getAnnualProdBonus() {
return annualProdBonus;
}
public void setAnnualProdBonus() throws NumberFormatException, IOException {
System.out.println("Enter the annual production bonus for superwiser");
this.annualProdBonus = Double.parseDouble(br.readLine());
}
}
class TeamLeader extends ProductionWorker{
Double monthlyBonus;
int traininHoursPerDay;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
TeamLeader(){
this.monthlyBonus=5000.00;//Setting default values
this.traininHoursPerDay=5;//default value
}
public Double getMonthlyBonus() {
return monthlyBonus;
}
public void setMonthlyBonus() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter monthlty bonus fo team leader");
this.monthlyBonus = Double.parseDouble(br.readLine());
}
public int getTraininHoursPerDay() {
return traininHoursPerDay;
}
public void setTraininHoursPerDay() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter training hours attended");
this.traininHoursPerDay = Integer.parseInt(br.readLine());
}
}
The above code is working. Please add your needs in the runner class main method.
Thanks.