Many program written with inheritance could be written with composition, question help

Many program written with inheritance could be written with composition, question help

Exercises 9.3

Many program written with inheritance could be written with composition instead and vice versa. Rewrite class BasePlusCommissionEmployee (fig9.11 ) of the commissionEmployeeBasePlusCommissionEmployee hierarchy to use composition rather than inheritance.

Exercise 10.12

(Payroll System Modification) Modify the payroll system of Fig. 10.4 Fig. 10.9 to include private instance variable birthDate in class Employee. Use class Date of Fig. 8.7 to represent an employee’s birthday. Add get methods to class Date and replace method toDateString with method toString. Assume that payroll is processed once per month. Create an array of Employee variables to store references to the various employee objects. In a loop, calculate the payroll for each Employee (polymorphically), and add a $100.00 bonus to the person’s payroll amount if the current month is the month in which the Employee’s birthday occurs.

"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.


Discount Code: CIPD30



Click ORDER NOW..

order custom paper