Question: MCC - CIS162AB - C++ Level I P06 Call-by-Reference - 15 points The purpose of this C++ programming project is to introduce the student to
| MCC - CIS162AB - C++ Level I P06 Call-by-Reference - 15 points |
The purpose of this C++ programming project is to introduce the student to designing and developing call-by-value and call-by-reference functions as well as using pointers as parameters. Rewrite program P05 so that it uses call-by-reference and pointer parameters. The call-by-reference and pointer parameters will replace needing to return a value with your functions. Please review PPT 05 for a detailed explanation on how to do this. Below are the function prototypes completely defined for your easy reference - pay close attention to the fact that we've added special pointer variables to each function for you to use.
Assignment Submission Submit the source code file Reminder: Use Ctrl-C to terminate endless loops. This program will be used by employees to determine what their weekly net pay would be based on their hourly rate and number of hours worked. Requirement 1: Use constant a global variable to store the following value: OVERTIME_RATE = 1.5 Requirement 2: Use constant local variables to store the following values: UNION_DUES = 10.00 FICA_RATE = 0.06 FEDERAL_RATE = 0.15 STATE_RATE = 0.05 Requirement 3: The user will be asked to input their hourly rate and number of hours worked. Requirement 4: The data entered will be validated. The hourly rate must be between $10.00 - $15.00 inclusive (10-15). The hours worked must be between 1 and 50 inclusive (1-50). Requirement 5: The program should then calculate gross and net pay using the user input and constants provided. Requirement 6: For the hours over 40 the employee gets paid 1.5 times their rate. Requirement 7: In addition, the net hourly rate will also be calculated and displayed, so that employees will know what their take-home pay per hour is. Requirement 8: The results should be displayed on the screen with an appropriate label preceding the value. Requirement 9: The amounts should line up under each other after their labels (see sample output). Requirement 10: The rates used to calculate FICA, federal, and state tax should be displayed after each of the corresponding amounts. Requirement 11: The output should be formatted to two decimal points. Requirement 12: You can choose your own variable names, but the function prototypes to use are: void inputRate(double& rate); void inputHours(int& hours); void calcGross(double rate, int hours, double& gross); void calcTax(double gross, double taxRate, double *taxAmount); Requirement 13: Define the calcTax function so that all three taxes can be calculated by calling the same function three times: calcTax(gross, FICA_RATE, &fica); calcTax(gross, FEDERAL_RATE, &federal); calcTax(gross, STATE_RATE, &state); Use these cases to test your program: Case # Rate Worked Case # Rate Worked ------ ----- ---- ------ ----- ---- 1 12.50 40 2 15.00 45 Sample Output: P06 - Your Name Enter a value between $10 and $15.00 for the hourly rate: 12.50 Enter a value between 1 and 50 for the hours worked: 40 Hourly Rate: 12.50 Hours Worked: 40 Gross Pay: 500.00 FICA Tax: 30.00 at 0.06 Federal Tax: 75.00 at 0.15 State Tax: 25.00 at 0.05 Union Dues: 10.00 Net Pay: 360.00 Net Hourly: 9.00 Thank you! Press any key to continue P06 - Your Name Enter a value between $10 and $15.00 for the hourly rate: 15 Enter a value between 1 and 50 for the hours worked: 45 Hourly Rate: 15.00 Hours Worked: 45 Gross Pay: 712.50 FICA Tax: 42.75 at 0.06 Federal Tax: 106.88 at 0.15 State Tax: 35.63 at 0.05 Union Dues: 10.00 Net Pay: 517.25 Net Hourly: 11.49 Thank you! Press any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
