Assignment 9 Solution

$30.00

Description

Problem 12.14 (Payroll System Modification) Modify the payroll system of Figs. 12.9-12.17 to include an additional Employee subclasses PieceWorker and HourlyWorker. A PieceWorker represents an employee whose pay is based on the number of pieces of merchandise produced. An HourlyWorker represents an employee whose pay is based on an hourly wage and the number of hours worked. Hourly workers receive overtime pay (1.5 times the hourly wage) for all hours worked in excess of 40 hours.

Class Pieceworker should contain private insurance variables wage (to store the employee’s wage per piece) and pieces (to store the number of pieces produced). Class HourlyWorker should contain private instance variables wage (to store the employee’s wage per hour) and hours (to store the hours worked) . In class Pieceworker, provide a concrete implementation of method earnings that calculates the employee’s earnings by multiplying the number of pieces produced by the wage per piece. In class HourlyWorker, provide a concrete implementation of method earnings that calculates the employee’s earnings by multiplying the number of hours worked by the wage per hour. If the number of hours worked is over 40. Be sure to pay the HourlyWorker for the overtime hours. Add a pointer to an object of each new class into the vector of Employee pointers in main. For each Employee, display its string representation and earnings.

Turn in pdfs of your test cases results by uploading them to T-Square (please no JPEG or PNG or word, upload a pdf doc for your test cases). Also in addition, upload the source code files (uncompiled) on or before the due date so your program may be tested. Only upload the files you changed or created, not the ones that had no changes. How your code is commented, how well you tested the program (just one test case or enough test cases to prove it works), any extra functionality, how you output your test results and details of program output will all be taken into consideration when grading your program. You should have comments at the top that includes your name, the date, explains what the program does and comments above the functions explaining what they do in addition to some comments as needed on lines that explain what that line does.


error: Content is protected !!