0

I'm completely new to C++ and trying to figure this stuff out I had posted a topic a couple days ago. After many frustrations and headaches, I deiced to start over. This is what I got:

```
#include<iostream>
#include<iomanip>
using namespace std;
double ot = 0;
double getHoursWorked();
double getPayRate();
double calcTax(double grossPay, double taxAmt);
double grossPay();
double calcIns(double insRate, double grossPay, double insAmt);
double getInsRate(double insuranceType, double insRate);
double calcBonus(double grossPay, double bonusPay);
double calcGross(double&, double);
void displayData(double, double, double, double, double, double, double );
int main()
{
//declare variables
double hours = 0.0, rate = 0.0, gross = 0.0, bonus = 0.0, tax = 0.0, insur = 0.0;
//get and calculate hours and pay
hours = getHoursWorked();
rate = getPayRate();
insur = getInsRate(gross, rate);
gross = calcGross(hours, rate);
bonus = calcBonus(gross, rate);
tax = calcTax(gross, tax);
displayData(hours,rate,ot,gross, bonus, tax, insur);
//display
system("pause");
return 0;
}
double getHoursWorked()
{
double hrs;
cout << "Please enter the number of hours worked: ";
cin >> hrs;
return hrs;
}
double getPayRate()
{
double pay;
cout << "Please enter your pay rate: $";
cin >> pay;
return pay;
}
double calcTax(double grossPay, double taxAmt)
{
if(grossPay >100)
taxAmt = grossPay * .15;
else if(grossPay >500)
taxAmt = grossPay * .10;
else if(grossPay >1000)
taxAmt= grossPay * .05;
else
taxAmt = 0;
return taxAmt;
}
double calcBonus(double grossPay, double bonusPay)
{
if(grossPay >100)
bonusPay = 1000;
else if(grossPay > 9000)
bonusPay = 600;
else
bonusPay = 0;
return bonusPay;
}
double getInsRate(double insuranceType, double insRate)
{
cout << "Insurance Type" ;
cin >> insuranceType;
if (insuranceType == '1')
insRate = .02;
else if (insuranceType == '2')
insRate = .03;
else if (insuranceType == '3')
insRate = .04;
else
insRate = .05;
return insRate;
}
double calcIns(double insRate, double grossPay, double insAmt)
{
insAmt = 0;
insAmt = insRate * grossPay;
return insAmt;
}
double calcGross(double &hrs, double pay)
{
if(hrs >40)
{
ot = hrs - 40;
hrs = 40;
}
return (hrs * pay) + (ot * pay * 1.5);
}
void displayData(double hours, double pay, double overTime, double grs, double bonusPay, double taxAmt, double getInsRate)
{
cout << fixed << setprecision(2);
cout << "\nReg hours worked:" << setw(9)<< right << hours << endl;
cout << "Bonus" << setw(9) << right << bonusPay << endl;
cout << "Ins Rate" << setw(9) << right << calcIns << endl;
cout << "Over Time worked:" << setw(9) << right << overTime << endl;
cout << "Tax:" << setw(9) << right << taxAmt << endl;
cout << "Rate of Pay: " << setw(9) << right << pay << endl;
cout << "Gross Pay: " << setw(9) << right << grs << endl;
cout << "\n\n";
}
```

It is supposed to multiply the insurance rate, depending on the insurance type the user inputs, times gross pay. All I get for Insurance rate is 00401440. No matter what I put when it asks for insurance type. While I realize this code might not look the best, because I'm just taking one section of a huge program at a time, I apologize and hope someone can help me figure this out. Thank you.