Question: Program#2(30points): Design and implement the following classes: Class Person that defines three data fields: name, address and phone number. Class Student that inherits from class
Program#2(30points): Design and implement the following classes: Class Person that defines three data fields: name, address and phone number. Class Student that inherits from class Person. Class Students defines one data field: status as string variable (Freshmen, Sophomore, Junior, Senior) Class Employee that inherits from class Person. Class Employee defines two data fields: salary and date hired (dateHired is an object of class Date) Class Faculty that inherits from class Employee. Class Faculty defines two data fields: office number (as string, e.g., J-337) and rank (Assistant Professor, Associate Professor, Full Professor) Class Staff that inherits from class Employee. Class Staff defines one data field: title (e.g., Advisor, Accountant, Painter, Manager, etc.) In each class, override method toString() to print out the class name and the data fields of that class with proper labels. Write a test program named testPerson to create at least one object of each class and call method toString) on that object. Organize your output so that it is easy to see how the inheritance relationship affects the characteristics of each object when printed out. Output would be similar to the following sample run
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
