// Timothy Price CS1A Practicum 1
/*******************************************************************************
* Calculate report
*
* This program receives values for identification and income and creates a
* report of the calculated payroll.
*
* Inputs:
* employee number
* gross pay
* state tax
* federal tax
* FICA withholdings
*
* Outputs:
* displayable report
* net pay calculation
******************************************************************************/
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
// Data dictionary
int employee;
float federal;
float fedtotal = 0;
float fica;
float ficatotal = 0;
float gross;
float grosstotal = 0;
float net_pay;
float net_total = 0;
float state;
float statetotal = 0;
// Initial employee input
cout << "Enter employee number: ";
cin >> employee;
cout << employee << endl;
// Loop to receive inputs, with input confirmation
while(employee != 0){
cout << "Enter the gross pay for this employee: ";
cin >> gross;
cout << "$" << gross << endl;
cout << "Enter the state tax: ";
cin >> state;
cout << "$" << state << endl;
cout << "Enter the federal tax: ";
cin >> federal;
cout << "$" << federal << endl;
cout << "Enter the FICA withholdings: ";
cin >> fica;
cout << "$" << fica << endl;
cout << "Enter another employee number or '0' to stop: ";
cin >> employee;
cout << employee << endl;
// total calculations, adding each input per loop iteration
net_pay = (gross) - (state + federal + fica);
fedtotal += federal;
ficatotal += fica;
grosstotal += gross;
net_total += net_pay;
statetotal += state;
}
// Completion confirmation
cout << "Entry complete." << endl << endl;
// Display report
cout << "\t\t\t\t----- WEEKLY PAYROLL REPORT -----" << endl;
cout << "-----------------------------------------------------------------";
cout << "------------" << endl;
cout << "Gross pay\tState Tax\tFederal Tax\tFICA withholding\t";
cout << "Net Pay ";
cout << "-----------------------------------------------------------------";
cout << "------------" << endl;
cout << fixed << setprecision(2);
cout << "$" << grosstotal << "\t$" << statetotal << "\t\t$" << fedtotal;
cout << "\t$" << ficatotal << "\t\t\t\t$" << net_total;
return 0;
}