Implement a superclass Person. Make two classes, Student and Instructor, that in
ID: 640931 • Letter: I
Question
Implement a superclass Person. Make two classes, Student and Instructor, that inherit from Person. A person has a name and a year of birth. A student has a major, and an instructor has a salary. Writhe the class definitions, the constructors, and the methods toString for all classes. For Person the constructors should include a no-arg constructor and one that accepts in the name of the person. For student there should be a no-arg constructor and a constructor that accepts in both name and major. And, for Instructor there should be a no-arg constructor as well as one that accepts in name and salary.
Supply a test program that exercises all of the capabilities of each class.
Explanation / Answer
class Person { private String name; private int year; Person(String name, int year) { this.name = name; if (yearRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.