Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ REWRITE 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

In C++ REWRITE 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. Sample output in image below.

#include #include using namespace std; double inputRate()//function to take input rate { double rate; do { cout>rate;//asks for rate }while(rate15);//validation rate return rate; } double inputHours()//function to take input hours { double hrs; do { cout>hrs;//asks for hours }while(hrs50);//valid data return hrs; } double calcGross(double rate,double hours)//function to calculate gross pay { double gross,temp; if(hours>40)//if overtime { temp = hours-40; hours = hours-temp; gross = (rate*1.5)*temp; gross = gross+(rate*hours);//calculate gross pay } else { gross = rate*hours; } return gross; } double calcTax(double gross,double taxRate)//function to calculate tax { double amount; amount = gross*taxRate; return amount; } int main() { double UNION_DUES = 10.00;//constants double FICA_RATE = 0.06; double FEDERAL_RATE = 0.15; double STATE_RATE = 0.05; double rate = inputRate();//call inputRate() double hrs = inputHours();//call inputHours() double grs = calcGross(rate,hrs);//call calcGross() double fdTax = calcTax(grs,FEDERAL_RATE);//calcTax() to calculate FEDERAL tax double frTax = calcTax(grs,FICA_RATE);//calcTax() to calculate FICA tax double stTax = calcTax(grs,STATE_RATE);////calcTax() to calculate STATE tax double tax = fdTax+frTax+stTax+UNION_DUES; double netPay = grs-tax;//calculate net pay double netHrly = netPay/hrs;//calculate net Hourly cout

image text in transcribed

image text in transcribed

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 - 18.00 FICA_RATE - 2.26 FEDERAL_RATE=0.15 STATE_RATE - 0.25 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 $18.ee - $15.ea inclusive (18-15). The hours worked must be between 1 and se inclusive (1-5e). Requirement 5: The program should then calculate gross and not 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. Requirements: 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 outout). Requirement le: 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 caicGross(double rato, int hours, double gross): void calcTax (double gross, double taxato, double taxAmount); Requirement 13: Define the calciak 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.5a 48 2 15.88 45 Sample Output: P86 - Your Nane Enter a value between $10 and $15.ee for the hourly rate: 12.58 Enter a value between 1 and 50 for the hours worked: 48 12.50 Hourly Rate: Hours Worked: Gross Pay: FICA Tax: Federal Tax: State Tax : Union Dues: Net Pay: Net Hourly: See.ee 38.00 at 0.06 75.ee at 8.15 25.02 at 2.es 1e.ee 360.00 9. Thank you! Press any key to continue Your Name Enter a value between $10 and $15.ee for the hourly rate: 15 Enter a value between 1 and se for the hours worked: 45 Hourly Rate: Hours Morked: Gross Pay: FICA Tax: Federal Tax: State Tax: Union Dues: Net Pay: Net Hourly: 15.ee 45 712.5a 42.75 at 2.ee 106.88 at 8.15 35.63 at 2.85 1a.ee 517.25 11.49 Thank you! Press any key to contanus

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

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

Students also viewed these Databases questions