Modify the payroll system of Figs. 10.410.9 to include an additional Employee subclass PieceWorker that represents an

Question:

Modify the payroll system of Figs. 10.4–10.9 to include an additional Employee subclass PieceWorker that represents an employee whose pay is based on the number of pieces of merchandise produced. Class PieceWorker should contain private instance variables wage (to store the employee’s wage per piece) and pieces (to store the number of pieces produced). Provide a concrete implementation of method earnings in class PieceWorker that calculates the employee’s earnings by multiplying the number of pieces produced by the wage per piece. Create an array of Employee variables to store references to objects of each concrete class in the new Employee hierarchy. For each Employee, display its String representation and earnings.

Fig. 10.4

I // Fig. 10.4: Employee.java 2 // Employee abstract superclass. 3 4 5 6 7 8 9 10 || 12 13 14 15 16 17 18 19

Fig. 10.9I 2 3 5 6 7 8 9 10 || 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 20 1 2 3 4 35 36 31 38 39

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: