Final answer:
To implement derived classes Hourly and Executive from the Employee base class, follow the steps described.
Step-by-step explanation:
Part 2 - Deriving Hourly and Executive classes from Employee
In order to implement the derived classes Hourly and Executive from the base class Employee, follow these steps:
- For the Hourly class:
- Define a new class Hourly that is derived from the Employee class.
- In the constructor of the Hourly class, call the base class constructor and initialize the additional private member representing the number of hours worked to 0.
- Implement a new method addHours in the Hourly class that allows the user to increase the number of hours the employee has worked.
For the Executive class:
- Define a new class Executive that is derived from the Employee class.
- In the constructor of the Executive class, call the base class constructor and initialize the additional private member representing the amount of bonus pay to 0.
- Implement a new method awardBonus in the Executive class that allows the user to set the bonus pay for this employee.
Write a short main program that tests the new implemented functions in part 2.1 and 2.2.