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 1
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 problem1, 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 1
Create 3 students
Student1 : Name James, DOB: 01/01/2000, Major: English
Student2: Name Jane, DOB: 01/20/2000, Major: Math
Student3: Name James, DOB: 01/01/2000, Major: English
Output
Student1.equals(Student2) : False
Studen1.equsts(Student3): True
Student1.toString() should print "Name James, DOB: 01/01/2000, Major: English"
Implement similar example for instructors, create 3 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 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 Programming Questions!