Question

In this exercise, you will create a program that displays the gross pay for one or...

In this exercise, you will create a program that displays the gross pay for one or more employees. If necessary, create a new project named Introductory16 Project, and save it in the Cpp8\Chap10 folder. The program should allow the user to enter the number of hours the employee worked and his or her hourly pay rate. Use a negative sentinel value to stop the program. Employees are paid at their regular pay rate for hours worked from 1 through 37. They are paid time and a half for the hours worked from 38 through 50, and double-time for the hours worked over 50. Use a void function to calculate and return the employee’s overtime pay, if applicable. Enter your C++ instructions into a source file named Introductory16.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Test the application appropriately. (Hint: If an employee earns $10 per hour and works 37 hours, the gross pay is $370.00. If he or she works 38 hours, the gross pay is $385.00. If he or she works 51 hours, the gross pay is $585.00.)

Homework Answers

Answer #1

main.cpp

#include <iostream>

using namespace std;

void grossPay(int hours, int paid){

double total;

if(hours <= 37){

total = hours * paid;

}

else if (hours >= 38 && hours <=50){

total += paid * 37;

total += (paid*1.5)*(hours-37);

}

else{

total += paid * 50;

total += (paid*2)*(hours-50);

}

cout<<"Gross Pay: $"<<total<<endl;

}

int main() {

int hours, paid;

cout<<"Enter number of hours worked: "<<endl;

cin>>hours;

cout<<"Enter the amount paid for one hour: "<<endl;

cin>>paid;

grossPay(hours,paid);

return 0;

}

Output:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a program which: Write a program which uses the following arrays: empID: An array of...
Write a program which: Write a program which uses the following arrays: empID: An array of 7 integers to hold employee identification numbers. The array should be initialized with the following values: 1, 2, 3, 4, 5, 6, 7. Hours: an array of seven integers to hold the number of hours worked by each employee. payRate: an array of seven doubles to hold each employee’s hourly pay rate. Wages: an array of seven doubles to hold each employee’s gross salary....
PSc 2-6 Calculate Gross Pay Calculate gross pay for each of the five employees listed in...
PSc 2-6 Calculate Gross Pay Calculate gross pay for each of the five employees listed in the prior exercise: NOTE: For simplicity, all calculations throughout this exercise, both intermediate and final, should be rounded to two decimal places at each calculation. 1: Alice Rhoades earns a weekly wage of $1,200. During the most recent week, she worked 48 hours. Gross Pay = $ 2: Hank Long earns a biweekly wage of $3,400. During the most recent week, he worked 45...
Create a C# application You are to create a class object called “Employee” which included eight...
Create a C# application You are to create a class object called “Employee” which included eight private variables: firstN lastN dNum wage: holds how much the person makes per hour weekHrsWkd: holds how many total hours the person worked each week. regHrsAmt: initialize to a fixed amount of 40 using constructor. regPay otPay After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods:  constructor  properties  CalcPay(): Calculate the regular...
Determine the gross pay for each employee listed below. When necessary, round intermediate calculations and the...
Determine the gross pay for each employee listed below. When necessary, round intermediate calculations and the final answer to the nearest cent. Clay Jones is paid time-and-a-half for all hours over 40. He worked 47 hours during the week. His regular pay rate is $17.80 per hour. $ Mary James worked 43 hours during the week. She is entitled to time-and-a-half for all hours in excess of 40 per week. Her regular pay rate is 27.10 per hour. $ Lori...
Calculate gross pay for each of the following employees of Replay Co. The company offers a...
Calculate gross pay for each of the following employees of Replay Co. The company offers a regular wage rate of $7.90/hour to all employees. Under an incentive plan in place for all employees, this rate increases for any employee who can meet weekly production goals. The increased rates and corresponding thresholds that must be met are as follows: $8.40/hour for producing at least 2,200 units $11.75/hour for producing at least 2,600 units $12.25/hour for producing at least 3,100 units $15/hour...
Python Coding Federal law requires that hourly employees be paid “time and a half” for all...
Python Coding Federal law requires that hourly employees be paid “time and a half” for all work above 40 hours per week. Write a program that prompts the user to enter their hours worked and hourly wage (e.g. $20.00/hr) and then computes and prints their pay. The program should test the number of hours worked to determine if any overtime pay is due. As an example for regular pay (no overtime) suppose that a worker makes $10/hr and works 40...
Brianna Watt, a consultant doing business as Watt Gives, wants a program to create an invoice...
Brianna Watt, a consultant doing business as Watt Gives, wants a program to create an invoice for consulting services. Normally, she works on a project for five days before sending an invoice. She writes down the number of hours worked on each day and needs a program that asks for these amounts, totals them, and multiplies the amount by her standard rate of $30 per hour. The invoice should include Briannas business name, the clients business name, the total number...
For each employee, first calculate gross pay. Then determine taxable income used to calculate federal income...
For each employee, first calculate gross pay. Then determine taxable income used to calculate federal income tax withholding, Social Security tax, and Medicare tax. NOTE: For simplicity, all calculations throughout this exercise, both intermediate and final, should be rounded to two decimal places at each calculation. 1. An employee works 37 regular hours during a workweek in August of 2018. He was hired four years ago, earns a salary of $135,100/year, and is exempt from the overtime provisions of the...
(Use C++ language) Create a program, named threeTypesLoops.cpp, that does the following; 1. Uses a For...
(Use C++ language) Create a program, named threeTypesLoops.cpp, that does the following; 1. Uses a For Loop that asks for a number between 1 and 10; Will double the number each time through the loop and display the answer. Will run five times, so the number will have been doubled five times, and the answer displayed five times. After the loop, display a message saying 'It's done!'. 2. Uses a While Loop; Ask the user to input a friend's name....
Pay Rate Hours Worked Gross Pay Deductions Net Pay Employee Number 468921 15.00 28 420.00 325.00...
Pay Rate Hours Worked Gross Pay Deductions Net Pay Employee Number 468921 15.00 28 420.00 325.00 95.00 357942 16.50 50 825.00 205.00 620.00 816543 5.00 40 200.00 45.00 245.00 963248 57.60 40 2,304.00 10.00 2,294.00 1. Calculate examples of these batch totals: hash total financial total record count Assume the following rules govern normal data: Employee numbers are five digits in length and range from 1000 through 99999. Maximum pay rate is $35, and minimum is $15. Hours worked should...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT