Question: [18 marks] (Inheritance) Design a class named Person and its two subclasses named Student and Employee. A person has a name, an address (a String

 [18 marks] (Inheritance) Design a class named Person and its two

[18 marks] (Inheritance) Design a class named Person and its two subclasses named Student and Employee. A person has a name, an address (a String type), a phone number and an email address. A student has a year level number (1,2,3, or 4). An employee has a office and salary. Override the toString method in all the three classes to display the class name. Create appropriate constructor(s) for each class. But do not need to create any 3. accessor or mutator for any of the classes. Outside any of the classes above, define a method with the following header: public static void displayObject(Person object) This method calls the toString0 method of the Person object. Implement the classes and the method above. Write a test program that creates a Person object, a Student object, and an Employee object, and then call the displayObject metho three times to pass the three objects above to the method, respectively, to display the cl name of each object public class Tester

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!