Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that displays a weekly payroll report. A loop in the program sho

ID: 3620632 • Letter: W

Question

Write a program that displays a weekly payroll report. A loop in the program should
ask the user for the employee num ber~ gross pay, state tax, federal tax, and FICA
withholdings. The loop will terminate when 0 is entered fo r the employee number.
After the data is emered, the program should display totals for gross pay, state tax,
federal tax, FICA withhold ings. and net pay.

Input Validation: Do not accept negative numbers for any of the items entered. Do not
accept values for state. federal, or FlCA 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 re-enter the data for that employee.

Explanation / Answer

please rate - thanks #include <iostream>
using namespace std;
int main()
{int id;
double gross,state,fed,fica;
cout<<"Enter employee ID (0 to exit): ";
cin>>id;
while(id>0)
{do
{
cout<<"Enter gross pay: ";
cin>>gross;
while(gross<0)
    {cout<<"Must be >=0 ";
     cout<<"Enter gross pay: ";
     cin>>gross;
     }
cout<<"Enter state tax: ";
cin>>state;
while(state<0||state>gross)
    {cout<<"Must be >=0 and <gross ";
     cout<<"Enter state tax: ";
     cin>>state;
     }
   
cout<<"Enter federal tax: ";
cin>>fed;
while(fed<0||fed>gross)
    {cout<<"Must be >=0 and <gross ";
     cout<<"Enter fed tax: ";
     cin>>fed;
     }     
cout<<"Enter FICA: ";
cin>>fica;
while(fica<0||fica>gross)
    {cout<<"Must be >=0 and <gross ";
     cout<<"FICA: ";
     cin>>fica;
     }
if(state+fed+fica>gross)
     cout<<"Taxes cannot be greater then salary-start over ";
}while(state+fed+fica>gross);
cout<<" Enter employee ID (0 to exit): ";
cin>>id;                 
}         
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote