Question: Modify class Employee from Exercise 10.17 so that it implements the Payable interface of Fig. 10.11. Replace the Salaried-Employee objects in the application of Fig.
Modify class Employee from Exercise 10.17 so that it implements the Payable interface of Fig. 10.11. Replace the Salaried-Employee objects in the application of Fig. 10.14 with the Employee objects from Exercise 10.17 and demonstrate processing the Employee and Invoice objects polymorphically.
Exercise 10.17
Exercise 9.16 asked you to remodel Chapter 9’s CommissionEmployee–BasePlusCommissionEmployee inheritance hierarchy as a class Employee in which each Employee has a different CompensationModel object. In this exercise, reimplement Exercise 9.16’s CompensationModel class as an interface that provides a public abstract method earnings that receives no parameters and returns a double. Then create the following classes that implement interface CompensationModel:
In your test application, create Employee objects with each of the CompensationModels described above, then display each Employee’s earnings. Next, change each Employee’s CompensationModel dynamically and redisplay each Employee’s earnings.
Fig. 10.11

Fig. 10.14
I // Fig. 10.11: Payable.java 2 // Payable interface declaration. 3 4 public interface Payable { 5 public abstract double getPayment Amount(); // no implementation 6}
Step by Step Solution
3.27 Rating (159 Votes )
There are 3 Steps involved in it
Based on the information that youve provided and the images you want to modify the Employee class from Exercise 1017 so that it implements the Payable interface from Fig 1011 The Payable interface inc... View full answer
Get step-by-step solutions from verified subject matter experts
