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
|
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
double Gross_Pay(double&, double&, double&, double, double);
double Tax(double&, double&);
double Net_Pay(double&, double&, double&);
double display_results(); //haven't used in my code : HELP *
double Gross_Pay(double& regularpay, double& overtimepay, double& grosspay, double payrate, double hoursworked)
{
regularpay = hoursworked * payrate;
overtimepay = (hoursworked-40) * payrate * 1.5;
grosspay = regularpay + overtimepay;
return grosspay;
}
double Tax(double& tax, double& grosspay)
{
tax = grosspay * 0.15;
return tax;
}
double Net_Pay(double& netpay, double& grosspay, double& tax)
{
netpay = grosspay - tax ;
return netpay;
}
int main()
{
double regularpay,overtimepay,payrate,hoursworked,grosspay,tax,netpay;
cout<<"Enter number of hours worked:"; cin>>payrate;
cout<<"Enter pay rate:"; cin>>hoursworked;
Gross_Pay(regularpay,overtimepay,grosspay,payrate,hoursworked);
Tax(tax,grosspay);
Net_Pay(netpay,grosspay,tax);
cout<<left<<setw(20)<<"GROSS PAY"<<setw(20)<<"TAX"<<setw(20)<<"NET PAY"<<endl;
cout<<left<<setw(20)<<grosspay<<setw(20)<<tax<<setw(20)<<netpay<<endl;
system("Pause");
return 0;
}
|