06 Laboratory Exercise 1 - Inheritance
06 Laboratory Exercise 1 - Inheritance
Laboratory Exercise
People in School
Objective:
Software Requirements:
▪ Latest version of NetBeans IDE
▪ Java Development Kit (JDK) 8
Procedure:
1. Create a folder named LastName_FirstName in your local drive. (ex. Reyes_Mark)
2. Create a new project named LabExer6. Set the project location to your own folder. The main class
should be named CollegeList. This class shall contain the main method.
3. Add four (4) Java classes named Person, Student, Faculty, and Employee.
4. Write a simple information system that will store and display the complete information of a student,
faculty, or employee. Refer to the UML Class Diagram for the names of the variables and methods.
This should be the sequence of the program upon execution:
a. Prompt the user to select among Employee, Faculty, or Student, by pressing E, F, or S.
b. Ask the user to type the name and contact number.
c. For Employee, ask the user to type the employee's monthly salary and the department where
he/she belongs to (Ex. Registrar). Afterwards, display name, contact number, salary, and
department.
For Faculty, ask the user to press Y if the faculty member is regular/tenured or N if not. Then,
display name, contact number, salary, department, and status.
For Student, ask the user to type the student's enrolled program (Ex. BSIT, BSTM) and
his/her year level (integers 1 to 4). Afterwards, display name, contact number, program, and
year level.
Person
- name: String
- contactNum: String
+ setName(String n): void
+ getName(): String
+ setContactNum(String c): void
+ getContactNum(): String
Employee Student
- salary: double - program: String
- department: String - yearLevel: int
+ setSalary(double s): void + setProgram(String p): void
+ getSalary(): double + getProgram(): String
+ setDepartment(String d): void + setYearLevel(String y): void
+ getDepartment(): String + getYearLevel(): int
Faculty
- status: boolean
+ isRegular(): boolean
Sample Output: