Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions