You have already worked with an Employee class in updating the Payroll Reporting program. This time, structure your class so that you allow for three types of employees: salaried, hourly, and commission.
Your program should use a menu system for data input, with the following choices:
Inheritance. You've probably already figured out that you will create an Employee base class and then three derived classes, one for each employee type. Think about what attributes and methods all Employees may have in common, and which must be different for the different types of employees. Polymorphism. All three types of employees should have a method called WeeklyPay() to calculate the weekly pay (duh!) for employees of that type. The method will be implemented differently in each of the three derived classes of Employee. Part B (advanced) - How can you make the WeeklyPay() method more truly polymorphic? (Hint: Try using virtual functions.) |
Home > Assignments >