Question: Write a program that displays a weekly payroll report. A loop in the program should ask the user for the employee number, gross pay, state
Write a program that displays a weekly payroll report. A loop in the program should ask the user for the employee number, gross pay, state tax, federal tax, and FICA withholdings.The loop will terminate when 0 is entered for the employee number. After the data is entered, the program should display totals for gross pay, state tax, federal tax, FICA withholdings, and net pay.Input Validation: Do not accept negative numbers for any of the items entered.Do not accept values for state, federal, or FICA withholdings that are greater than the gross pay. If the sum state tax + federal tax + FICA withholdings for any employee is greater than gross pay, print an error message and ask the user to reenter the data for that employee.
#include
#include
#include
#include
using namespace std;
int main()
{
int employeeNumber = 1;
double grossPayTotal = 0.0;
double stateTaxTotal = 0.0;
double federalTaxTotal = 0.0;
double FICATotal = 0.0;
double Netpay = 0.0;
cout
while (employeeNumber != 0)
{
cout
cin >> employeeNumber;
if (employeeNumber != 0)
{
double employeeGrossPay = 0.0;
double employeeStateTaxes = 0.0;
double employeeFederalTaxes = 0.0;
double employeeFICA = 0.0;
bool condition;
do
{
cout
cin >> employeeGrossPay;
cout
cin >> employeeFederalTaxes;
cout
cin >> employeeStateTaxes;
cout
cin >> employeeFICA;
cout
if (employeeGrossPay
employeeStateTaxes
{
cout
cout
cin >> employeeFederalTaxes;
condition = true;
}
else if (employeeFICA > employeeGrossPay || employeeFederalTaxes > employeeGrossPay ||
employeeStateTaxes > employeeGrossPay)
{
cout
cout
cout
cout
cin >> employeeNumber;
condition = true;
}
else if (employeeFICA + employeeStateTaxes > employeeGrossPay)
{
cout
condition = true;
}
else
condition = false;
} while (condition);
grossPayTotal += employeeGrossPay;
stateTaxTotal += employeeStateTaxes;
federalTaxTotal += employeeFederalTaxes;
FICATotal += employeeFICA;
Netpay = grossPayTotal - stateTaxTotal - federalTaxTotal - FICATotal;
}
}
cout
cout
cout
cout
cout
cout
cout
system("pause");
return 0;
}



I need help with the last part.
Also,
I need help on the Flowchart Diagram and pseudocode.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
