Program isn't printing correctly
<p>I believe my program is still going through the if statements after it is declared invalid. It should print invalid filling status or invalid exemption status on the same line with the id. Buts its printing the valid statement above the the id and still displaying the taxableIncome and taxRate and TaxAmount.
    while(fscanf(tax,"\n%d %c %d %d ",&amp;taxpayerId, &amp;fillingStatus, &amp;grossIncome, &amp;taxExemptions) != EOF)
    {    </p>

<pre><code>                    fillingStatus = toupper(fillingStatus);

                    if ( fillingStatus == 'S')
                    {
                        taxableIncome = grossIncome - 3000 - 1000 * taxExemptions;

                    }
                    else if ( fillingStatus == 'M')
                    {
                        taxableIncome = grossIncome - 3000 - 1000 * taxExemptions;

                    }   
                    else if ( fillingStatus == 'J')
                    {
                        taxableIncome = grossIncome - 6000 - 1000 * taxExemptions;

                    }

                    if (taxableIncome &lt; 0)
                    {
                        taxableIncome = 0;
                    }


                    if ( fillingStatus == 'S')
                    {
                            if (taxableIncome &lt; 5000)
                            {
                                taxRate = 0.15;
                            }
                            if (taxableIncome  &gt; 20000)
                            {
                                taxRate = 0.31;
                            }
                            else
                            {
                                taxRate = 0.22;
                            }
                    }     
                    else if ( fillingStatus == 'M')
                    {
                            if (taxableIncome &lt; 10000)
                            {
                                taxRate = 0.15;

                            }   
                            if (taxableIncome &gt; 40000)
                            {
                                taxRate = 0.31;
                            }
                            else
                            {
                                taxRate = 0.22;
                            }
                    }
                    else if ( fillingStatus == 'J')
                    {
                            if (taxableIncome &lt; 7000)
                            {
                                taxRate = 0.17;
                            }
                            if (taxableIncome &gt; 25000)
                            {    
                                taxRate = 0.33;
                            }
                            else
                            {
                                taxRate = 0.24;
                            } 
                    }
                    else
                    {   
                            printf("\n %d     **** Invalid filling status ****",taxpayerId);
                            continue;
                    }

                    if (taxExemptions &gt; 12  || taxExemptions &lt; 0) 
                    {
                        printf("\n %d     **** Invalid number of exemptions ****", taxpayerId);
                    } 
                    else 
                    {
                        taxAmount = taxableIncome * taxRate;
                        printf("\n %d %15.2f  %15.2f  %18.2f",taxpayerId,taxableIncome,taxRate,taxAmount);
                    }  
</code></pre>

<p>Output is suppose to look like this:</p>

<blockquote>
<pre><code>Taxpayer ID    Taxable Income    Tax Rate        Tax Amount
-----------    --------------    --------        ----------

111111111           4000.00        0.15            600.00
222222222          36500.00        0.22           8030.00
333333333          19152.00        0.24           4596.48
444444444    **** Invalid filing status ****
555555555          67000.00        0.31          20770.00
666666666          53197.00        0.33          17555.01
777777777          19000.00        0.22           4180.00
888888888    **** Invalid number of exemptions ****
999999999          46308.00        0.33          15281.64
101010101          91602.00        0.31          28396.62
121212121           9525.00        0.15           1428.75
131313131              0.00        0.17              0.00
</code></pre>
</blockquote>

<p>My out put look like this:</p>

<blockquote>
  <p>Taxpayer ID    Taxable Income<br>
  Tax Rate        Tax Amount
      -----------    --------------    --------        ----------</p>

<pre><code>111111111           4000.00        0.22            880.00
222222222          36500.00        0.31          11315.00
333333333          19152.00        0.24           4596.48
444444444          **** Invalid filing status ****           
555555555          67000.00        0.31          20770.00
666666666          53197.00        0.24          12767.28
777777777          **** Invalid number of exemptions ****        
888888888           3543.00        0.22
999999999          46308.00        0.24            779.46
101010101          91602.00        0.22          11113.92
121212121           9525.00        0.31           2952.75
131313131              0.00        0.24              0.00
</code></pre>
</blockquote>
