Oh no its a bug

So this program is to prompt the user for their income and then tell the person how much tax they should pay on their income. It passes all tests except when I put in 5000 it comes back with $0.08 when the correct output should be $687.08

I can't seem to find what I've done wrong here.

As always thanks for your help everyone on this board has really helped in my learning process of this language.
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
float computeTax(float income)
{
   float yearlyIncome;
   float monthlyTax;
   float tax;

   yearlyIncome = income * 12;

   if ((0 <= yearlyIncome) && (yearlyIncome < 15100))
      tax = yearlyIncome * 0.10;
   if ((15100 <= yearlyIncome) && (yearlyIncome < 61300))
      tax = 1,510 + 0.15 * (yearlyIncome - 15100);
   if ((61300 <= yearlyIncome) && (yearlyIncome < 123700))
      tax = 8440 + 0.25 * (yearlyIncome - 61300);
   if ((123700 <= yearlyIncome) && (yearlyIncome < 188450))
      tax = 24040 + 0.28 * (yearlyIncome - 123700);
   if ((188450 <= yearlyIncome) && (yearlyIncome < 336550))
      tax = 42170 + 0.33 * (yearlyIncome - 188450);
   if (336550 <= yearlyIncome)
      tax = 91043 + 0.35 * (yearlyIncome - 336550);

   monthlyTax = tax / 12;

   return monthlyTax;
}

int main()
{
   float income;

   cout.setf(ios::fixed);
   cout.setf(ios::showpoint);
   cout.precision(2);

   cout << "Income: ";
   cin  >> income;

   cout << "Your tax is $" << computeTax(income) << endl;

   return 0;
}
1
2
tax = 1,510 + 0.15 * (yearlyIncome - 15100);
//     ^ WTF is this? 
haha been staring at the screen too long man that that totally slipped by me! Thanks that did the trick. Also love the comment.
Topic archived. No new replies allowed.