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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
#include "stdafx.h"
#include <iostream>
using namespace std;
double calculateTaxes(double numDepends, double hourlyPay, double hoursWorkd,double grossPay);
int main()
{
double empNum,numDepends,hourlyPay=0,hoursWorkd =0,grossPay= hoursWorkd * hourlyPay;
cout << "Enter your employee number. "<< endl;
cin >> empNum;
cout << "Enter the number of dependents. "<< endl;
cin >> numDepends;
cout << "Enter your hourly pay rate. "<< endl;
cin >> hourlyPay;
//cout << "Enter the city income tax witheald to date. "<< endl;
//cin >> cityTaxes;
//cout << "Enter the federal income tax withheld to date. "<< endl;
//cin >> fedTaxes;
cout << "Enter the hours worked this period. "<< endl;
cin >> hoursWorkd;
cout << " **Employee Number: " <<empNum<< endl;
cout <<endl;
cout << "The output is: " <<calculateTaxes( numDepends, hourlyPay, hoursWorkd, grossPay );
//cout << " **Gross Pay: $ "<< grossPay <<endl;
//cout <<endl;
//calculateTaxes (numDepends, hourlyPay, hoursWorkd, grossPay);
//cout<<endl;
return 0;
}
double calculateTaxes(double numDepends, double hourlyPay, double hoursWorkd,double grossPay )
{
double cityTaxes , fedTaxes, totalWitheld, netPay;
grossPay = hoursWorkd * hourlyPay * 12 ;
if (grossPay <= 40000)
cityTaxes = .0115 * grossPay;
else cityTaxes = 40000 * .0115;
fedTaxes = (grossPay - (numDepends * 50.00 )) * .20;
totalWitheld = cityTaxes + fedTaxes;
netPay = grossPay-totalWitheld;
cout << " **Gross Pay: $ "<< grossPay <<endl;
cout << " **City taxes withheld: $ " << cityTaxes <<endl;
cout<< endl;
cout << " **Federal taxes witheld: $ " << fedTaxes<< endl;
cout<<endl;
cout << " **Total withheld: $ " << totalWitheld<<endl;
cout<<endl;
cout << " **Net pay: $ " << netPay<< endl;
//return 0;
return cityTaxes, fedTaxes, totalWitheld, netPay;
}
|