Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design and implement a class representing a Person along with 3 subclasses using

ID: 638632 • Letter: D

Question

Design and implement a class representing a Person along with 3 subclasses using the following guidelines:

a. Create a class named Person and its three subclasses named Employee, Student, Retired.

b. The Person has the following data fields: name, year_of_birth, isStudying, and isEmployed. It also has methods for setting and getting the values of each of the fields along with a method to calculate the current age and display the status of a Person. A constructor that sets the isStudying and isEmployed fields to false is also included in the Person class. You are welcome to add additional data fields and methods if you like.

c. For your Person, Employee, Student and Retired classes the getStatus method returns the values shown in the table below:

Finally, create a Java test class that simulates using your Person class. In your test class you should at a minimum: a) Construct 4 instances of a Person (considering also the subclasses), b) print the names of your instances c) print the status of your instances.   

Your programs should compile and run without errors.

Class Age isStudying isEmployed getStatus Person False Flase Unemployed Student < 30 True Student Employee >30 and <65 True Employed Retired > 65 False False Retired

Explanation / Answer

check

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote