views:

63

answers:

0
#include <iostream>
 #include <string>
 #include <iomanip>

 using std::cout;
 using std::cin;
 using std::endl;
 using std::string;
 using std::setprecision;
 using std::fixed;

//function prototypes
void getInput(string &, double) ; void calcFedTaxes ( double , double, double &, double &); void calcnetPay ( double &, double , double, double); void displayInfo(string, double, double, double);

int main() {
//declare constants and variables const double FWT_RATE = .2; const double FICA_RATE = .08; string dname = ""; double dsalary = 0.0; double dfwtTax = 0.0; double dficaTax = 0.0; double dnetPay = 0.0;

//display output in fixed-point notation with two decimal places
cout << fixed << setprecision(2);


 //call function to get input and calculate salary and taxes 
  void getInput (string dname, double dsalary, double dnetPay);

  void calcFedTaxes(double Fsalary, double FwtRate, double FicaRate,
                    double & withholdingTax, double & incomeTax); 

  void calcnetPay(double & netPay, double weeklySalary, double fwtTax,
                  double ficaTax); 

  void displayInfo (string dname, double dfwtTax, double dficaTax, 
                   double dnetPay);


system ("pause");

} //end call function

//*****function definitions*****

void getInput(string iname, double isalary)
{
//enter input items
 cout << "Enter name: ";
 cin >> iname;
 cout << "weekly salary: ";
 cin >> isalary;
}
void calcFedTaxes (double Fsalary, double FwtRate,  double FicaRate, 
double & withholdingTax, double & incomeTax)
{
withholdingTax = Fsalary * FwtRate;
incomeTax      = Fsalary * FicaRate;     

}
void calcnetPay (double & netPay, double weeklySalary, double fwtTax, 
double ficaTax)
{
netPay = weeklySalary - fwtTax - ficaTax;
}

void displayInfo(string dname, double dfwtTax,  double dficaTax, 
double dnetPay)
{
cout << "name: " << dname;
cout << "With holding Tax: " << dfwtTax;
cout << "With holding Fica: "<<dficaTax;
cout << "Net pay: " <<dnetPay;
cin>> dnetPay;

//end of displayInfo function


return;

}