Question
Exercise 1 : Fill in the code (places in bold) and note that the function computePaycheck determines the net pay by subtracting 15% from the
Exercise 1: Fill in the code (places in bold) and note that the function computePaycheck determines the net pay by subtracting 15% from the gross pay. Both gross and net are returned to the main() function where those values are printed.
Exercise 2: Compile and run your program with the following data and make sure you get the output shown.
Exercise 3: Are the parameters gross and net, in the modified calPaycheck function you created in Exercise 1 above, pass by value or pass by reference?
Exercise 4: Alter the program so that gross and net are printed in the function compute computePaycheck instead of in main(). The main() function executes the statement
-------------------------------------------------------------------------------
// This program takes two numbers (payRate & hours)
// and multiplies them to get grosspay.
// It then calculates net pay by subtracting 15%
//PLACE YOUR NAME HERE
#include
#include
using namespace std;
//Function prototypes
void printDescription();
void computePaycheck(float, int, float&, float&);
int main()
{
float payRate;
float grossPay;
float netPay;
int hours;
cout
cout
printDescription(); //Call to Description function
cout
cin >> payRate;
cout
cin >> hours;
cout
computePaycheck(payRate,hours,grossPay,netPay);
// Fill in the code to output grossPay
cout
cout
return 0;
}
// ********************************************************************
// printDescription
//
// task: This function prints a program description
// data in: none
// data out: no actual parameter altered
//
// ********************************************************************
void printDescription() // The function heading
{
cout
cout
cout
cout
cout
}
// *********************************************************************
// computePaycheck
//
// task: This function takes rate and time and multiples them to
// get gross pay and then finds net pay by subtracting 15%.
// data in: pay rate and time in hours worked
// data out: the gross and net pay
//
// ********************************************************************
void computePaycheck(float rate, int time, float& gross, float& net)
{
// Fill in the code to find gross pay and net pay
}
c:\Users\elee\Desktop\CPSC151\Hands-on\Hands-on 6-1\Debug\Hands-on 6-1 lelcome to the Pay Roll Program This program takes two numbers (pay rate & hours) and multiplies them to get gross pay it then calculates net pay by subtracting 15% Please input the pay per hour 9.50 Please input the number of hours worked 40 The gross pay is 380.00 The net pay is $323.00 le hoped you enjoyed this program Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started