C++,UMLClass.
Requirement
Consider the class hierarchy shown in this figure:
- Create the super abstract class “Employee” that has the following instance variables, constructor, and methods( you may need to add more methods):
- a) name
- b) date_of_birth
- c) starting_date
- d) ssn
- e) phone_number
- f) Constructor
- g) set/get methods
- h) toString method
- Create the sub class “Hourly_Based_Employee” that is derived from the super class
“Employee” and has the following instance variables, constructor, and methods:
- a) name
- b) date_of_birth
- c) starting_date
- d) ssn
- e) phone_number
- f) per_Hour
- g) hours
- h) Constructor
- i) set/get methods
- j) compute_Salary that is based on the hours* per_hour
- k) toString method
- Create the sub class “Salary_Based_Employee” that is derived from the super class
“Employee” and has the following instance variables, constructor, and methods:
- a) name
- b) date_of_birth
- c) starting_date
- d) ssn
- e) phone_number
- f) salary
- g) Constructor
- h) set/get methods
- i) compute_salary that is based on his salary
- j) toString method
- k)
- Create the sub class “Manager_Employee” that is derived from the class
“Salary_Based_Employee” and has the following instance variables, constructor, and methods:
- a) name
- b) date_of_birth
- c) starting_date
- d) ssn
- e) phone_number
- f) salary
- g) bonus
- h) Constructor
- i) set/get methods
- j) compute_salary that is based on his salary and bonus
- k) toString method
- Create the “Testing” class that has the main method and does the following:
- a) Are you able to create an object of Employee class?
- b) Use the constructor to create object of Hourly_Based_Employee class.
- c) Use the constructor to create object of Salary_Based_Employee class.
- d) Use the constructor to create object of Manager_Employee class.
- e) Define three elements array of “Employee”.
- f) Let each element in the array refer to objects created in b, c, and d
- g) Call compute_salary and toString using objects created in b, c, and d
- h) Call compute_salary and toString using array elements defined in f. You need to design the abstract class in a way that allow you to call this method.
- i) What is the difference between results obtained from g and h.