Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

5. Understand how cultural values influence conflict behavior.

Answered: 1 week ago

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago