Help with void calculation
Dec 15, 2013 at 2:19am UTC
I probably just need to fix the if statements. But anyways, when I compile, the fedTax always ends being something like -0.00000000001293844... Any tips would be appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
void calcTax (double & fedTax, int numDepend, double grossPay, double & taxRate)
{
if (numDepend = 0)
{
taxRate = .2;
}
if ((numDepend > 0) && (numDepend < 5))
{
taxRate = .15;
}
if ((numDepend > 4) && (numDepend < 7))
{
taxRate = .1;
}
if (numDepend > 6)
{
taxRate = .07;
}
fedTax = grossPay * taxRate;
}
Dec 15, 2013 at 3:20am UTC
Line 4: if (numDepend = 0)
What's wrong with this?
Last edited on Dec 15, 2013 at 3:46am UTC
Dec 15, 2013 at 4:39am UTC
Line 4: should be comparison operator== instead of assignment operator=
What you would have is:
if (numDepend == 0)
Topic archived. No new replies allowed.