Question: ADD POLYMORPHISM TO THE STAFF CLASS WITH TWO FUNCTIONS get score() AND ADD INHERITANCE TO STUDENT CLASS To the following code class Main { public

ADD POLYMORPHISM TO THE STAFF CLASS WITH TWO FUNCTIONS get score()
AND
ADD INHERITANCE TO STUDENT CLASS
To the following code
class Main {
public static void main(String[] args) {
Person person1 = new Person();
person1.name = "John Doe";
person1.address = "Abuja";
System.out.println(person1.name+" "+person1.address);
Staff staff1 = new Staff("Jane Doe","Kano",2,400);
System.out.println(staff1.name+" "+staff1.address+" "+staff1.staff_Number+" "+staff1.salary);
Student stud1 = new Student("Joe Doe","Lagos",3,"Computer Science",true);
System.out.println(stud1.name+" "+stud1.address+" "+stud1.studId+" "+stud1.department+" "+stud1.regStatus);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!