Modified Project 5
+- Modified Project 5 File
This commit is contained in:
parent
7db9595edf
commit
c6fe12062c
1 changed files with 48 additions and 45 deletions
|
|
@ -179,33 +179,36 @@ double calculateArizonaTax(double adjustedIncome)
|
|||
// check for baseline bracket
|
||||
// calculate tax for baseline
|
||||
totalAZTax = adjustedIncome * AZ_TAX_BASELINE_RATE;
|
||||
return totalAZTax;
|
||||
}
|
||||
else if(adjustedIncome < AZ_TAX_FIRST_BRACKET_LIMIT)
|
||||
{
|
||||
// check for first bracket and baseline bracket
|
||||
// calculate tax for first and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * AZ_TAX_BASELINE_RATE);
|
||||
totalAZTax = incomeLeft * AZ_TAX_FIRST_BRACKET_RATE;
|
||||
return totalAZTax;
|
||||
totalAZTax = AZ_TAX_BASELINE_LIMIT * AZ_TAX_BASELINE_RATE;
|
||||
incomeLeft = adjustedIncome - AZ_TAX_BASELINE_LIMIT;
|
||||
totalAZTax = totalAZTax + (incomeLeft * AZ_TAX_FIRST_BRACKET_RATE);
|
||||
}
|
||||
else if(adjustedIncome < AZ_TAX_SECOND_BRACKET_LIMIT)
|
||||
{
|
||||
// check for second, first, and baseline bracket
|
||||
// calculate tax for second, first, and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * AZ_TAX_BASELINE_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * AZ_TAX_FIRST_BRACKET_RATE);
|
||||
totalAZTax = incomeLeft * AZ_TAX_SECOND_BRACKET_RATE;
|
||||
return totalAZTax;
|
||||
totalAZTax = AZ_TAX_BASELINE_LIMIT * AZ_TAX_BASELINE_RATE;
|
||||
totalAZTax = totalAZTax +
|
||||
(AZ_TAX_FIRST_BRACKET_LIMIT * AZ_TAX_FIRST_BRACKET_RATE);
|
||||
incomeLeft = adjustedIncome - AZ_TAX_FIRST_BRACKET_LIMIT;
|
||||
totalAZTax = totalAZTax + (incomeLeft * AZ_TAX_SECOND_BRACKET_RATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, apply the max, second, first, and baseline bracket
|
||||
// calculate tax for max, second, first, and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * AZ_TAX_BASELINE_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * AZ_TAX_FIRST_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * AZ_TAX_SECOND_BRACKET_RATE);
|
||||
totalAZTax = incomeLeft * AZ_TAX_MAX_RATE;
|
||||
totalAZTax = AZ_TAX_BASELINE_LIMIT * AZ_TAX_BASELINE_RATE;
|
||||
totalAZTax = totalAZTax +
|
||||
(AZ_TAX_FIRST_BRACKET_LIMIT * AZ_TAX_FIRST_BRACKET_RATE);
|
||||
totalAZTax = totalAZTax +
|
||||
(AZ_TAX_SECOND_BRACKET_LIMIT * AZ_TAX_SECOND_BRACKET_RATE);
|
||||
incomeLeft = adjustedIncome - AZ_TAX_SECOND_BRACKET_LIMIT;
|
||||
totalAZTax = totalAZTax + (incomeLeft * AZ_TAX_MAX_RATE);
|
||||
}
|
||||
|
||||
// display results
|
||||
|
|
@ -245,69 +248,69 @@ double calculateFederalTax(double adjustedIncome)
|
|||
// check for baseline bracket
|
||||
// calculate tax for baseline bracket
|
||||
totalFedTax = adjustedIncome * FED_TAX_BASELINE_RATE;
|
||||
return totalFedTax;
|
||||
}
|
||||
else if(adjustedIncome < FED_TAX_FIRST_BRACKET_LIMIT)
|
||||
{
|
||||
// check for first bracket and baseline bracket
|
||||
// calculate tax for first and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * FED_TAX_BASELINE_RATE);
|
||||
totalFedTax = incomeLeft * FED_TAX_FIRST_BRACKET_RATE;
|
||||
return totalFedTax;
|
||||
totalFedTax = FED_TAX_BASELINE_LIMIT * FED_TAX_BASELINE_RATE;
|
||||
incomeLeft = adjustedIncome - FED_TAX_BASELINE_LIMIT;
|
||||
totalFedTax = (incomeLeft * FED_TAX_FIRST_BRACKET_RATE) + totalFedTax;
|
||||
}
|
||||
else if(adjustedIncome < FED_TAX_SECOND_BRACKET_LIMIT)
|
||||
{
|
||||
// check for second, first, and baseline bracket
|
||||
// calculate tax for second, first, and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * FED_TAX_BASELINE_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_FIRST_BRACKET_RATE);
|
||||
totalFedTax = incomeLeft * FED_TAX_SECOND_BRACKET_RATE;
|
||||
return totalFedTax;
|
||||
totalFedTax = FED_TAX_BASELINE_LIMIT * FED_TAX_BASELINE_RATE;
|
||||
totalFedTax = totalFedTax + (FED_TAX_FIRST_BRACKET_LIMIT * FED_TAX_FIRST_BRACKET_RATE);
|
||||
incomeLeft = adjustedIncome - FED_TAX_FIRST_BRACKET_LIMIT;
|
||||
totalFedTax = (incomeLeft * FED_TAX_SECOND_BRACKET_RATE) + totalFedTax;
|
||||
}
|
||||
else if(adjustedIncome < FED_TAX_THIRD_BRACKET_LIMIT)
|
||||
{
|
||||
// check for third, second, first, and baseline bracket
|
||||
// calculate tax for third, second, first, and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * FED_TAX_BASELINE_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_FIRST_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_SECOND_BRACKET_RATE);
|
||||
totalFedTax = incomeLeft * FED_TAX_THIRD_BRACKET_RATE;
|
||||
return totalFedTax;
|
||||
totalFedTax = FED_TAX_BASELINE_LIMIT * FED_TAX_BASELINE_RATE;
|
||||
totalFedTax = totalFedTax + (FED_TAX_FIRST_BRACKET_LIMIT * FED_TAX_FIRST_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_SECOND_BRACKET_LIMIT * FED_TAX_SECOND_BRACKET_RATE);
|
||||
incomeLeft = adjustedIncome - FED_TAX_SECOND_BRACKET_LIMIT;
|
||||
totalFedTax = (incomeLeft * FED_TAX_THIRD_BRACKET_RATE) + totalFedTax;
|
||||
}
|
||||
else if(adjustedIncome < FED_TAX_FOURTH_BRACKET_LIMIT)
|
||||
{
|
||||
// check for fourth, third, second, first, and baseline bracket
|
||||
// calculate tax for fourth, third, second, first, and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * FED_TAX_BASELINE_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_FIRST_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_SECOND_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_THIRD_BRACKET_RATE);
|
||||
totalFedTax = incomeLeft * FED_TAX_FOURTH_BRACKET_RATE;
|
||||
return totalFedTax;
|
||||
totalFedTax = FED_TAX_BASELINE_LIMIT * FED_TAX_BASELINE_RATE;
|
||||
totalFedTax = totalFedTax + (FED_TAX_FIRST_BRACKET_LIMIT * FED_TAX_FIRST_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_SECOND_BRACKET_LIMIT * FED_TAX_SECOND_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_THIRD_BRACKET_LIMIT * FED_TAX_THIRD_BRACKET_RATE);
|
||||
incomeLeft = adjustedIncome - FED_TAX_THIRD_BRACKET_LIMIT;
|
||||
totalFedTax = (incomeLeft * FED_TAX_FOURTH_BRACKET_RATE) + totalFedTax;
|
||||
}
|
||||
else if(adjustedIncome < FED_TAX_FIFTH_BRACKET_LIMIT)
|
||||
{
|
||||
// check for fifth, fourth, third, second, first, and baseline bracket
|
||||
// calculate tax for fifth, fourth, third, second, first, and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * FED_TAX_BASELINE_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_FIRST_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_SECOND_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_THIRD_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_FOURTH_BRACKET_RATE);
|
||||
totalFedTax = incomeLeft * FED_TAX_FIFTH_BRACKET_RATE;
|
||||
return totalFedTax;
|
||||
totalFedTax = FED_TAX_BASELINE_LIMIT * FED_TAX_BASELINE_RATE;
|
||||
totalFedTax = totalFedTax + (FED_TAX_FIRST_BRACKET_LIMIT * FED_TAX_FIRST_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_SECOND_BRACKET_LIMIT * FED_TAX_SECOND_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_THIRD_BRACKET_LIMIT * FED_TAX_THIRD_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_FOURTH_BRACKET_LIMIT * FED_TAX_FOURTH_BRACKET_RATE);
|
||||
incomeLeft = adjustedIncome - FED_TAX_FOURTH_BRACKET_LIMIT;
|
||||
totalFedTax = (incomeLeft * FED_TAX_FIFTH_BRACKET_RATE) + totalFedTax;
|
||||
}
|
||||
else
|
||||
{
|
||||
// otherwise, apply the max, fifth, fourth, third, second, first, and baseline bracket
|
||||
// calculate tax for max, fifth, fourth, third, second, first, and baseline bracket
|
||||
incomeLeft = adjustedIncome - (adjustedIncome * FED_TAX_BASELINE_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_FIRST_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_SECOND_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_THIRD_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_FOURTH_BRACKET_RATE);
|
||||
incomeLeft = incomeLeft - (incomeLeft * FED_TAX_FIFTH_BRACKET_RATE);
|
||||
totalFedTax = incomeLeft * FED_TAX_MAX_RATE;
|
||||
totalFedTax = FED_TAX_BASELINE_LIMIT * FED_TAX_BASELINE_RATE;
|
||||
totalFedTax = totalFedTax + (FED_TAX_FIRST_BRACKET_LIMIT * FED_TAX_FIRST_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_SECOND_BRACKET_LIMIT * FED_TAX_SECOND_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_THIRD_BRACKET_LIMIT * FED_TAX_THIRD_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_FOURTH_BRACKET_LIMIT * FED_TAX_FOURTH_BRACKET_RATE);
|
||||
totalFedTax = totalFedTax + (FED_TAX_FIFTH_BRACKET_LIMIT * FED_TAX_FIFTH_BRACKET_RATE);
|
||||
incomeLeft = adjustedIncome - FED_TAX_FIFTH_BRACKET_LIMIT;
|
||||
totalFedTax = (incomeLeft * FED_TAX_MAX_RATE) + totalFedTax;
|
||||
}
|
||||
|
||||
// display results
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue