Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started