in java : Inheritance Let us suppose we have five classes which are the Person, Student, Employee,
Question:
in java :
Inheritance
Let us suppose we have five classes which are the Person, Student, Employee, Faculty, and Staff Classes. Moreover, let us make Student and Employee as subclasses of Person, and make Faculty and Staff as subclasses of Employee. Please Create the previous five classes in Java based on the following instructions:
a) The Person class has the following private properties:
- name: String and its accessor and mutator methods
b) The Student class has the following methods and private properties:
- studentId: long
- Constructor with two arguments: name, studentId
- Override toString() in the Student class to return the name and studentId
c) The Employee class has the following private properties:
- employeeId: int and its accessor and mutator methods
d) The Faculty class has the following methods and private properties:
- rank: String
- Constructor with three arguments: name, employeeId, rank
- Override toString() in the Faculty class to return the name, employeeId, and rank
e) The Staff class has the following methods and private properties:
- title: String
- Constructor with three arguments: name, employeeId, title
- Override toString() in the Staff class to return the name, employeeId, and title
create a test program to creates objects from the Student, Faculty and Staff classes, and then invokes toString() methods for all three.
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang