Lab 6 - Inheritance and Polymorphism Answer The Following Questions
Lab 6 - Inheritance and Polymorphism Answer The Following Questions
Instructor-led Demo:
1. The Account class is to model a bank account. An account has the properties
account number, balance, and annual interest rate, and methods to deposit and
withdrawal. Create two subclasses for checking and saving accounts. A checking
account has an overdraft limit, but a savings account cannot go overdrawn. Test your
program.
Exercise:
1. Implement a class named Person and two subclasses of Person named Student
and Employee. Make Faculty and Staff subclasses of Employee. A person
has a name, address, phone number, and email address. A student has a status
(freshman, sophomore, junior, or senior). Define the status as a constant (Hint: Use
Enum). An employee has an office, salary, and date-hired. Define a class named
MyDate that contains the fields year, month, and day. A faculty member has office
hours and a rank. A staff member has a title, override the toString method in each
class to display the class name and the person’s name.
a. Furthermore from Q1, make FullTime and PartTime subclasses of
Staff. Full time staff has a fixed salary whereas part time staff has a salary
depending on worked hour. Implement this requirement that demonstrate the
earning for both staff.
b. Test your program. Demonstrate the result to the instructor.