Question: Need help. Java program Exercise 10.16 (Accounts Payable System Modification) It's possible to include the functionality of the pay- roll application (Figs. 10.4-10.9) in the

Need help. Java program

Exercise 10.16(Accounts Payable System Modification) It's possible to include the functionality of the pay- roll application (Figs. 10.4-10.9) in the accounts payable application without modifying Employee subclasses SalariedEmployee , HourlyEmployee , CommissionEmployee or BasePlusCommission- Employee. To do so, you can modify class Employee (Fig. 10.4) to implement interface Payable and declare method getPaymentAmount to invoke method earnings . Method getPaymentAmount would then be inherited by the subclasses in the Employee hierarchy. When getPaymentAmount is called for a particular subclass object, it polymorphically invokes the appropriate earnings method for that subclass. Reimplement Exercise 10.15 using the original Employee hierarchy from the payroll application of Figs. 10.4-10.9. Modify class Employee as described in this exercise, and do not modify any of class Employee 's subclasses.

Need help. Java program Exercise 10.16(Accounts Payable System Modification) It's possible to

include the functionality of the pay- roll application (Figs. 10.4-10.9) in the

accounts payable application without modifying Employee subclasses SalariedEmployee , HourlyEmployee , CommissionEmployee

or BasePlusCommission- Employee. To do so, you can modify class Employee (Fig.

10.4) to implement interface Payable and declare method getPaymentAmount to invoke method

earnings . Method getPaymentAmount would then be inherited by the subclasses in

the Employee hierarchy. When getPaymentAmount is called for a particular subclass object,

it polymorphically invokes the appropriate earnings method for that subclass. Reimplement Exercise

10.15 using the original Employee hierarchy from the payroll application of Figs.

10.4-10.9. Modify class Employee as described in this exercise, and do not

modify any of class Employee 's subclasses. Fig. 14 Employee abstract superclass

I I Fig. 10.4: Emp loyee.java 2 / Employee abstract superclass 4

public abstract class Employee private final String firstName; private final String las

private final String socialSecurityNumber; tName; 10 // constructor public Employee(String firstName, String

lastName, 12 String socialSecurityNumber) this.firstName firstName this.lastName-lastName; this.socialSecurityNumber socialSecurityNumber; 16 17 18

Fig. 14 Employee abstract superclass I I Fig. 10.4: Emp loyee.java 2 / Employee abstract superclass 4 public abstract class Employee private final String firstName; private final String las private final String socialSecurityNumber; tName; 10 // constructor public Employee(String firstName, String lastName, 12 String socialSecurityNumber) this.firstName firstName this.lastName-lastName; this.socialSecurityNumber socialSecurityNumber; 16 17 18 19 20 21 // return first name public String getFirstName O return firstName; 23 24 25 26 27 // return 1ast name public String getLastNameC return lastName 29 30 31 32 // return social security number public String getSocialSecurityNumberO 34 return socialSecurityNumber; 35 37 / return String representation of Employee object 39 0verride public String toStringo return String, format("%s %s%nsocial security number: %s", getFirstNameC), getLas tName O, gtocialSecurityNumber O) 45/ abstract me thod must be overridden by concrete subclasses public abstract double earnings O // no implementation here 47 I/ end abstract class Emp loyee

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!