(Practice) A C++ program is required that calculates and displays the weekly gro
ID: 3636050 • Letter: #
Question
(Practice) A C++ program is required that calculates and displays the weekly gross pay and net pay of two employees. The first employee is paid an hourly rate of $16.43, and the second is paid an hourly rate of $12.67. Both employees have 20% of their gross pay withheld for income tax, and both pay 2% of their gross pay, before taxes for medical benefits.a. for this programming problem how many outputs are required?
b. How many inputs does this problem have?
c. Write an algorithm written for Exercise 7c, using the following sample data: the first employee works 40 hours during the week, and the second employee works 35 hours. .
Explanation / Answer
please rate - thanks
you weren't very specific on exactly how to do this
a. for this programming problem how many outputs are required? 2
b. How many inputs does this problem have? 3
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{int num,i;
double salary, gross, hours;
cout<<"How many employees are there: ";
cin>>num;
for(i=1;i<=num;i++)
{cout<<"For employee #"<<i<<" ";
cout<<"Enter hourly salary: ";
cin>>salary;
cout<<"enter hours worked: ";
cin>>hours;
gross=hours*salary;
cout<<"gross pay: $"<<setprecision(2)<<fixed<<gross<<endl;
gross=gross-(.02*gross); //medidical
gross=gross-(.2*gross); //tax
cout<<"net pay: $"<<setprecision(2)<<fixed<<gross<<endl<<endl;
}
system("pause");
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.