North South University Department of Electrical and Computer Engineering CSE 215L: Programming Language II Lab Lab
North South University Department of Electrical and Computer Engineering CSE 215L: Programming Language II Lab Lab
Lab – 9: Inheritance
Objective:
● To understand inheritance and its usage
● To learn to utilize inheritance to ensure reusability of existing code
Task:
1. Implement the following classes:
In main method, create a Faculty object and display name, age, salary and initial. Call the
toString() method of the Faculty object to display all of its information.
Person Employee
- name: String - department: String
- age: int - designation: String
- address: String
/* constructor, accessor, mutator */
/* constructor, accessor, mutator */
PartTimeEmployee FullTimeEmployee
- hours: double - basic: double
- rate: double - allowance: double
/* constructor */ /* constructor */
/* accessor-mutator */ /* accessor-mutator */
/* toString */ /* toString */
+ salary(): double + salary(): double
Create an object for PartTimeEmployee and FullTimeEmployee and print their salary.