Question

In: Computer Science

Please use C++ program. uses a while statement to determine the gross pay for each of...

Please use C++ program.

uses a while statement to determine the gross pay for each of several employees. When someone works 41 hours or more. They get paid 1.5x more so my problem is that in my else if statement. The C++should ask repeatedly if the user wants to continue: y or n, if the user types y, then the program should ask for the hours and rate for another employee then display the grosspay. When the user type n, then the program stops.

Solutions

Expert Solution

C++ code:

#include <iostream>
using namespace std;
int main()
{
//initializing choice
char ch='y';
//initializing hour and pay
float hour,rate;
//looping as long as ch is 'y'
while(ch=='y'){
//asking for number of hours
cout<<"Enter the number of hours: ";
//accepting it
cin>>hour;
//asking for rate
cout<<"Enter the rate: ";
//accepting it
cin>>rate;
if(hour>=41)
cout<<"Gross pay: "<<hour*rate*1.5<<endl;
else
cout<<"Gross pay: "<<hour*rate<<endl;
//asking if he want to continue
cout<<"Do you want to continue (y/n): ";
//accepting it
cin>>ch;
}
return 0;
}


Screenshot:


Input and Output:


Related Solutions

Develop a C++ program that will determine the gross pay and net pay (after taxes). Each...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more. Sample input/outpt dialog Enter # of yours...
Develop a C++ program that will determine the gross pay and netpay (after taxes). Each...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more.
In C Program #include Create a C program that calculates the gross and net pay given...
In C Program #include Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage. The program should compile without any errors or warnings (e.g., syntax errors) The program should not contain logical errors such as subtracting values when you meant to add (e.g., logical errors) The program should not crash when running (e.g., runtime errors) When you run the program, the output should look like this: Hours per Week:...
Write a program that uses a while statement to read integers from the user and prints...
Write a program that uses a while statement to read integers from the user and prints the sum, average, and largest of these numbers. The input should terminate if the user enters 999. The average should be output with 4 digits of precision. c++ please ASAP
Write a C program that meets the following requirements. Uses a while loop to display the...
Write a C program that meets the following requirements. Uses a while loop to display the first 10 natural numbers (on one row, with a tab separating each number) Uses a while loop to find the sum of the second set of 10 natural numbers. Reads a user entry and displays all the natural numbers up to the user entry (on a column list with a new line separating each number). Finds and displays the sum of all natural numbers...
In C program, Use "do...while" and "for" loops to write a program that finds all prime...
In C program, Use "do...while" and "for" loops to write a program that finds all prime numbers less than a specified value.
PSc 2-7 Calculate Gross Pay with Commissions Calculate gross pay for each of the following employees....
PSc 2-7 Calculate Gross Pay with Commissions Calculate gross pay for each of the following employees. All are paid an overtime wage rate that is 1.5 times their respective regular wage rates. NOTE: For simplicity, all calculations throughout this exercise, both intermediate and final, should be rounded to two decimal places at each calculation. 1: Dennis McDonald earns both $8.25/hour and a 11% commission on all sales. During the most recent week, he worked 44 hours and made total sales...
Code in C# please. Write a program that will use the greedy algorithm. This program will...
Code in C# please. Write a program that will use the greedy algorithm. This program will ask a user to enter the cost of an item. This program will ask the user to enter the amount the user is paying. This program will return the change after subtracting the item cost by the amount paid. Using the greedy algorithm, the code should check for the type of bill. Example: Cost of item is $15.50 User pays a $20 bill $20...
c++ class Topics Branches if statement if/else statement Description Write a program that will determine whether...
c++ class Topics Branches if statement if/else statement Description Write a program that will determine whether the user passed or failed a test. The program will ask the user to input the following: Maximum Test Score - the maximum total scores in the test. Percent Pass Score - the minimum percent scores required to pass the test. User Test Score - the actual scores obtained by the user in the test. From the above input values, the program will compute...
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 47 hours (47 - 40 were overtime hours) during a workweek in December of 2017. He earns $39/hour, with his employer paying 1.5 times the regular rate of pay for overtime...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT