Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In a software development company, there are 2 types of employees; programmers a

ID: 3578415 • Letter: I

Question

In a software development company, there are 2 types of employees; programmers and testers Employee is an abstract class that represents the notion of an employee. This class has an abstract method work() which will be defined later in the Programmer and Tester class. The Employee class framework is given to you below: public abstract class Employee {private String name; private int id; public Employee (....) {//to be developed in your program} public abstract int work(); public String toString () {return nane + " ID; " +}} Programmer class is a subclass of Employee class. There a an instance variable modulesWrittenPerDay, which represents the average number of modules of code this programmer can produce. Of course there is a fluctuation depending on the difficulty level of the code s/he is writing. The Programmer class's work() returns the number of modules he wrote on a given day, which is a random number between 50% and 150% of his average. Tester class is a subclass of Employee class. A tester can, on the average, test a given number of modules of code per day, captured by an instance variable modulesTestedPerDay. The Tester class's work() returns the number of lines he tested on a given day, which is a number between 75% and 125% of his average. Project class that models a software development project. It should have at least the following fields. numModulcs - number of modules to be written (a number that is higher than modulesWrittenPerDay and modulesTestedPerDay) one programmer one tester Make sure the constructor of the Programmer class and Tester class use the constructor of the Employee class. Write toString() methods for these 2 subclasses that use the Employee's toString() method.

Explanation / Answer

abstract class Employee {
private int id;
private String name;
  
public Employee(int id, String name){
this.id=id;
this.name=name;
}
  
public abstract int work();
  
public String toString(){
return name+" id "+id;
}
  
}

class Programmer extends Employee{
  
int modulesWrittenPerDay;

public Programmer(int id, String name, int modulesWrittenPerDay) {
super(id, name);
this.modulesWrittenPerDay=modulesWrittenPerDay;
}

public int work() {
return (int )(Math. random() * (1.5*modulesWrittenPerDay) + (0.5*modulesWrittenPerDay));
}


public String toString() {
return super.toString();
}
  
  
}

class Tester extends Employee{

int modulesTestedPerDay;

public Tester(int id, String name, int modulesTestedPerDay) {
super(id, name);
this.modulesTestedPerDay= modulesTestedPerDay;
}
  
public int work() {
return (int )(Math. random() * (1.5*modulesTestedPerDay) + (0.5*modulesTestedPerDay));
}


public String toString() {
return super.toString();
}
}

public class Project {
int numModules;
Programmer p;
Tester t;

public Project(int numModules, Programmer p, Tester t) {
this.numModules = numModules;
this.p = p;
this.t = t;
}
  
  
}