Question: (Inheritance ) Write a Java program to meet the following requirements: 1. Design and declaration. All classes data fields should be private. (40%) a. Design
(Inheritance ) Write a Java program to meet the following requirements:
1. Design and declaration. All classes data fields should be private. (40%)
a. Design a class named Person (5%)
i. Person has a data field: name. Default: name is unknown,
ii. Person has a method printInfo() which will print all data fields.
iii. and its two subclasses named Student and Employee.
b. Design a class named Employee which is a subclass of Person. (5%)
i. Employee has a data field: salary. Default: salary is 0,
ii. Employee has a method printInfo()which will print all data fields( including
data fields in super class) (Hint: use super keyword to get info from super class.)
c. Design a class named Faculty which is a subclass of Employee. (10%)
i. Faculty has a data field: dept. Default: dept is none,
ii. Faculty has a method printInfo()which will print all data fields( including
data fields in super class)
d. Design a class named Student which is a subclass of Person. (10%)
i. Student has two data fields: age, default 0; email address, default: none
ii. Student has a method printInfo()which will print all data fields( including
data fields in super class)
e. Implement necessary constructors, accessor and mutator methods for all the above
classes.(10%)
2. Write a test program to create two Students and two Faculties, assign (NOT read from console) the
following information, and invokes their printInfo methods. xxxx is your Kean ID. (10%)
A Student object name: unknown, age: -1, email: none
A Student object name: demo_s2, age: 23, email:
A Faculty object name: demo_f1, salary: -1, dept: none
A Faculty object name: demo_f2, salary: 10000, dept: CS
3. Your program output should look like below: (10%)
Student name: unknown, age: -1, Email: none
Student name: demo_s2, age: 23, Email: xyz.com
Faculty name: demo_f1, salary: -1, dept: none
Faculty name: demo_f2, salary: 10000, dept: CS
Program4 is developed by
This project should be coded in ONE java file.
How to submit:
Please name the Java Class as XXXX_Program4 and file name as XXXX_Program4.java
where XXXX is your Kean email ID.
Please submit the program online at http://imc.kean.edu/students/
Assigned and Due date (by submit timestamp):
Assigned on 3/22/2017.
Due 11:59pm on 4/15/2017
Grading:
Design, input/output, format: 20%, Functionality (correctness): 20%, requirements: 60%
Late penalty: 10 points off per week for the first week, additional 20 points off per week after the first
week.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
