Question: Design three classes: Person, Student and faculty classes as below. Person -name: String -birthday: String +Person (String name, String birthdate + toString() : String Student
Design three classes: Person, Student and faculty classes as below.
| Person |
| -name: String |
| -birthday: String |
| +Person (String name, String birthdate |
| + toString() : String |
| Student |
| -ID: int |
| +Student (String name, int id, String birthdate) |
| +toString() : String |
| Faculty |
| -ID: int |
| -salary: double |
| +Faculty (String name, int id, String birthdate, double salary) |
| +toString(): String |
2. Implement toString() methods for each class that will print all data fields including data fields in super class. (Using "super.toString())
3. In main method:
a. create one student object and one faculty object
b. print the faculty's information(name, id, birthday, salary) by passing the student object to System.out.println()
c. print the student's information (name, id, birthday) by passing the student object to System.out.println().
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
