1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <iostream>
using namespace std;
void calcFedTaxes (int &salary, double FWTrate, double FICArate, double FWT, double FICA);
void calcNetPay (int &salary, double FWT, double FICA, int &netPay);
void displayInfo (double FWT, double FICA, int &netPay);
int main()
{
int salary = 0;
int netPay = 0;
double FWTrate = 0.2; //20% weekly salary
double FICArate = 0.08; //8% weekly salary
double FWT = 0;
double FICA = 0;
cout << "Enter salary: ";
cin >> salary;
while (salary > 0)
{
calcFedTaxes(salary, FWTrate, FICArate, FWT, FICA);
calcNetPay (salary, FWT, FICA, netPay);
displayInfo (FWT, FICA, netPay);
break;
}
return 0;
}
void calcFedTaxes (int salary, double FWTrate, double FICArate, double FWT, double FICA)
{
FWT = salary * FWTrate;
FICA = salary * FICArate;
}
void calcNetPay (int salary, double FWT, double FICA, int &netPay)
{
netPay = salary - FWT + FICA;
}
void displayInfo (double FWT, double FICA, int &netPay)
{
cout << "Federal Withholidng Tax: " << " $" << FWT << endl;
cout << "Federal Insurance Contributions Act: " << " $" << FICA << endl;
cout << "Net Pay: " << " $" << netPay << endl;
}
|