Question: Problem 1 Implement a superclass Person. Make two classes, Student and Instructor, that inherits from Person. A person has a name and a year of
Problem
Implement a superclass Person.
Make two classes, Student and Instructor, that inherits from Person.
A person has a name and a year of birth. A student has a major, and an instructor has a salary.
Write the class declarations, the constructors, and the methods toString & equals for all classes. Supply a test program for these classes and methods. Required Submission for both problems: Submit the java source code, writeup of the solution and screenshots of the output
Additional Information
Two instances of a class are equal if all properties have the same value. Make sure to review "equals" reference article posted in Chapter Notes.
For problem for two students to be equal, the objects has to be of the same type student and all properties name year of birth, major has to be the same.
toString method should print all the properties of the class; as Name and DOB is same for both student and instructor, you can implement it in the superclass "Person"
Problem
Create students
Student : Name James, DOB: Major: English
Student: Name Jane, DOB: Major: Math
Student: Name James, DOB: Major: English
Output
StudentequalsStudent : False
StudenequstsStudent: True
StudenttoString should print "Name James, DOB: Major: English"
Implement similar example for instructors, create instructors each instructor will have Name, Date of Birth and Salary. Please include writeup of algorithim or solution.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
