Question: Copy and paste the following code into Visual Studio. Run it and record the output. Next, Give the employees a raise by increasing their hourly
Copy and paste the following code into Visual Studio. Run it and record the output. Next, Give the employees a raise by increasing their hourly pay rate to $ How much more will the employee get in overtime pay compared to the original overtime pay amount from this increase when working hours in one week?
This program calculates gross pay. It uses global constants.
#include
#include
using namespace std;
Global constants
const double PAYRATE ; Hourly pay rate
const double BASEHOURS ; Max nonovertime hours
const double OTMULTIPLIER ; Overtime multiplier
Function prototypes
double getBasePaydouble;
double getOvertimePaydouble;
int main
double hours, Hours worked
basePay, Base pay
overtimePay Overtime pay
totalPay; Total pay
Get the number of hours worked
cout "How many hours did you work? ;
cin hours;
Get the amount of base pay
basePay getBasePayhours;
Get overtime pay, if any
if hours BASEHOURS
overtimePay getOvertimePayhours;
Calculate the total pay
totalPay basePay overtimePay;
Display the pay
cout setprecision fixed showpoint;
cout "Base pay $ setw basePay endl;
cout "Overtime pay $ setw overtimePay endl;
cout "Total pay $ setw totalPay endl;
return ;
getBasePay
This function uses the hours worked value passed in to
compute and return an employee's pay for nonovertime hours.
double getBasePaydouble hoursWorked
double basePay;
if hoursWorked BASEHOURS
basePay BASEHOURS PAYRATE;
else
basePay hoursWorked PAYRATE;
return basePay;
getOvertimePay
This function uses the hours worked value passed in
to compute and return an employee's overtime pay.
double getOvertimePaydouble hoursWorked
double overtimePay;
if hoursWorked BASEHOURS
overtimePay
hoursWorked BASEHOURS PAYRATE OTMULTIPLIER;
else
overtimePay ;
return overtimePay;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
