You are on page 1of 2

public abstract class Employee {

Scanner keyboard = new Scanner(System.in);


public String name;
public String ID;

//Employee constructor
public Employee(String name, String ID) {
this.name = name;
this.ID = ID;
}

//ID setter
public void setID(String ID) {
ID = keyboard.nextLine();
this.ID = ID;
}

//name getter
public String getName() {
return name;
}

public abstract String getStatus();

public abstract double calculateMonthlyPay();

@Override
public String toString() {
return "Employee{" + "name=" + name + ", ID=" + ID + '}';
}
}

class PartTimeEmp extends Employee {


public double hourlyRate;
public int hoursPerWeek;
//PartTimeEmp constructor
public PartTimeEmp(String name, String ID){
super(name, ID);
}

public void setHours(int hoursPerWeek) {


this.hoursPerWeek = hoursPerWeek;
}

public void setRate(double hourlyRate) {


this.hourlyRate = hourlyRate;
}

@Override
public String toString() {
return "PartTimeEmp{" + "hourlyRate=" + hourlyRate + ", hoursPerWeek=" + hoursPerWeek + '}';
}
}

class FullTimeEmp extends Employee {


double salary;
//FullTimeEmp constructor
public FullTimeEmp(String name, String ID) {
super(name, ID);
}

//Set salary of employee


public void setSalary(double salary) {
this.salary = salary;
}

@Override
public String toString() {
return "FullTimeEmp{" + "salary=" + salary + '}';
}
}

You might also like