Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language is c++ and need to run it in code blocks. this all is one assignment not different. Lab : Payroll Please read the instructions

language is c++ and need to run it in code blocks. this all is one assignment not different.

Lab : Payroll

Please read the instructions carefully! The goal of this lab is to have you experiment with various combinations of functions, parameters and return values.

Lab a: no parameters, no return value: Write a procedure called payroll that takes no parameters and no return value. The procedure should be called by main() and payroll() should prompt the user for his/her hourly pay rate (a double) and the number of hours he/she worked (an integer). Display the information to the user.

image text in transcribed

Lab b: 2 parameters, no return value: Write a function called calcPay that takes 2 parameters the hourly rate and number of hours worked but has no return value. The function should be called by payroll(). The function should calculate the users gross pay given its parameters: gross pay is equivalent to hours * rate. Display the information to the user.

image text in transcribed

Lab c: 1 parameter, 1 return value: Write a function called taxRate that takes 1 parameters the gross pay and returns an integer between 0 and 100 representing the users tax rate. The function should be called by calcPay(). The function should use the following if-else to decide what the users tax rate is:

If gross pay

Else if the gross pay is

Else if the gross pay is

Else if the gross pay is

Else if the gross pay is

Else the tax rate is 35%.

Lab d: Update the code in calcPay() to call taxRate() and then to subtract out the tax from the users gross pay, i.e.:

pay = grossPay * (1 rateOfTax/100.0);

image text in transcribed

When you are done writing the program, write in the comments at the top of the code a definition for the term: parameter. Make sure everyone in the group can explain the difference between the terms argument and parameter.

cAuserslebowringidocumentslvisual studio 20101Projects Lab 51Debug Lab 5.exe Please enter your hourly pay rate $500 Please enter the number of hours you worked: 30 You worked 30 hours earning a rate of $500/hour Press any key to continue . - hourt you orked: 30

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_2

Step: 3

blur-text-image_3

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

Students also viewed these Databases questions

Question

Interpret a high ratio of sales to assets.

Answered: 1 week ago

Question

7.9 Determine how the final hiring decision is made.

Answered: 1 week ago