In: Computer Science
USE JAVA
Develop the classes for the following requirements:
1. A class named Employee (general, for college)
2. A class named Instructor (more specific, for college)
3. A class named Staff (more specific, for college, HR officer, Marking staff)
Tasks:
1. Figure out the relationships among the classes;
2. Determine the abstract class, and the child classes;
3. For the abstract class, determine at least one abstract method;
4. Each class should at least two data members and one extra method;
5. Full implementation of all constructors, getters/setters and toString, and other methods;
6. Test your Java code and take screen shots
code:
package assignment;
abstract class Employee{ //abstract class
public String general;
public String college;
public Employee(String general,String college) {
//constructor
this.general=general;
this.college=college;
}
}
abstract class Instructor extends Employee{ // child class of
abstract class
public String specific;
public Instructor(String general, String college,
String specific) {
super(general, college);
this.specific=specific;
}
public abstract void start();//abstract methods
}
class Staff extends Instructor{
public String HR;
public Staff(String general, String college, String
specific, String HR) {
super(general, college,
specific);
this.HR=HR;
}
@Override
public void start() {
System.out.println(this.college);
}
public void setgeneral(String general) {
this.general=general;
}
public String getgeneral() {
return this.general;
}
public void setcollege(String college) {
this.college=college;
}
public String getcollege() {
return this.college;
}
public void setspecific(String specific) {
this.specific=specific;
}
public String getspecific() {
return this.specific;
}
public void setHR(String HR) {
this.HR=HR;
}
public String getHR() {
return this.HR;
}
public String toString()
{
return this.general +" " + this.college + "
"+this.specific+ " " + this.HR;
}
}
public class Cons {
public static void main(String args[]) {
Staff s=new
Staff("general","college","specific","HR");
System.out.println(s);
}
}
Note:***I hope your happy with my answer***If you have any doubt please comment me****Thank you......