C++ Program The Prime Furniture Company has recently hired you to help them conv
ID: 3685015 • Letter: C
Question
C++ Program
The Prime Furniture Company has recently hired you to help them convert their antiquated payroll system to computer-based model. They asked you to write a program that will print a one-week pay report for their employees. The values for the different salary deduction are given in the following table Each line of input will contain Employee initials Number of hours worked Hourly rate You should declare each deduction percentage as a named constant. Your output should display a report for the employee as in the following To stop enter XX11 Enter the initials, number of hours, and hourly rate, xx to stop: TJ 42 19 TJ Salary Report For the 42 hours that you worked at the rate of dollar 19 per hour, you earned dollar 798 Federal withholding tax that you have to pay is: dollar 143.64 State withholding tax that you have to pay is: percent 35.91 Hospitalization that you have to pay is: percent 25.65 Union dues that you have to pay is: percent 7.85 Your one salary is: dollar 584.95 Enter the initials, number of hours, and hourly rate, xx to stop: AE 51 23 AE Salary Report For the 51 hours that you worked at the rate of dollar 23 per hour, you earned dollar 1173 Federal withholding tax that you have to pay is: dollar 211.14 State withholding tax that you have to pay is: percent 52.785 Hospitalization that you have to pay is: percent 7.85 Your net salary is: dollar 875.575 Enter the initials, number of hours, and hourly rate, xx to stop: xx 11Explanation / Answer
#include<iostream>
#include<iomanip>
using namespace std;
#define FED_TAX 18
#define STATE_TAX 4.5
#define HOSPITALIZATION 25.65
#define UNION_DUES 7.85
int main()
{
string empDet;
int numberOfHoursWorked, hourlyRate;
double federalPay,statePay,hospitalPay,unionPay,totPay,netSal;
do
{
cout<<"Enter the initials, and hourly rate , XX to stop: ";
cin>>empDet>>numberOfHoursWorked>>hourlyRate;
if(empDet=="XX") break;
cout<<" "<<empDet<<" "<<"Salary Report"<<endl;
cout<<" "<<"****************"<<endl;
totPay=(numberOfHoursWorked*hourlyRate);
federalPay=totPay*(FED_TAX/100.00f);
statePay=totPay*(STATE_TAX/100.00f);
hospitalPay=totPay*(HOSPITALIZATION/100.00f);
unionPay=totPay*(UNION_DUES/100.00f);
netSal=totPay-(federalPay+statePay+hospitalPay+unionPay);
cout<<"For the "<<numberOfHoursWorked<<" hours that you worked at the rate of "<<hourlyRate<<"$ per hour, you earned $"<<totPay<<endl;
cout<<"Federal withholding tax that you have to pay is: $"<<setprecision(4)<<federalPay<<endl;
cout<<"State withholding tax that you have to pay is: $"<<setprecision(4)<<statePay<<endl;
cout<<"Hospitalization that you have to pay is: $"<<setprecision(4)<<hospitalPay<<endl;
cout<<"Union dues that have to pay is: $"<<setprecision(4)<<unionPay<<endl;
cout<<"Your net salary is: $"<<setprecision(4)<<netSal<<endl;
}
while(1);
}
OUTPUT:
Enter the initials, and hourly rate , XX to stop: TJ 42 19
TJ Salary Report
****************
For the 42 hours that you worked at the rate of 19$ per hour, you earned $798
Federal withholding tax that you have to pay is: $143.6
State withholding tax that you have to pay is: $35.91
Hospitalization that you have to pay is: $204.7
Union dues that have to pay is: $62.64
Your net salary is: $351.1
Enter the initials, and hourly rate , XX to stop: AE 51 23
AE Salary Report
****************
For the 51 hours that you worked at the rate of 23$ per hour, you earned $1173
Federal withholding tax that you have to pay is: $211.1
State withholding tax that you have to pay is: $52.78
Hospitalization that you have to pay is: $300.9
Union dues that have to pay is: $92.08
Your net salary is: $516.1
Enter the initials, and hourly rate , XX to stop: XX 1 1
Process returned 0 (0x0) execution time : 48.659 s
Press any key to continue.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.