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.
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...
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...
Please use C language and use link list to do this program. This program should ask...
Please use C language and use link list to do this program. This program should ask user to enter two fraction polynomials. Then user chocie if he want add it or multiple it. I need you please to test it to see if it work with these two fraction polynomials 1-  Left Poly Pointer: 1/1x2 + 3/4x + 5/12 2-Right Poly Pointer: 1/1x4 – 3/7x2 + 4/9x + 2/11 AND AFTER ADDING 3- Resulting Poly Pointer: 1/1x4 + 4/7x2 + 43/36x...
use linux or c program. please provide the answer in details. Write a program that will...
use linux or c program. please provide the answer in details. Write a program that will simulate non - preemptive process scheduling algorithm: First Come – First Serve Your program should input the information necessary for the calculation of average turnaround time including: Time required for a job execution; Arrival time; The output of the program should include: starting and terminating time for each job, turnaround time for each job, average turnaround time. Step 1: generate the input data (totally...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT