I wrote this code for a class assignment, and had posted it priorly, but I am still getting the incorrect output and can't see at this point as to what is causing this. (ex. 10,000 as a single filer comes out to a tax of 1,300, shouldn't it be 1,100?)
your code works well. so much so that the output conforms to what you wrote. I can tell you that the sum in line 63 is useless, since from your code you can only calculate one of the values between tax1, tax2 and tax3
My issue is when entering values over either of my basic limits(etc. 10000 for single and 18000 for married) the calculation comes back with an out put of "The tax is $3.2003e+006." , or something similar. How would I correct this?
Does this have something to do with the implemented tax rates? etc. the 800 + .15 and such?
Yes it does. Consider a final income of 50,000 * 800.15 the answer is 40,007,500.00. Not quite the number you are looking for. This would grow even larger with 8800.25 * 50,000.
You will need to figure out what 800, 4400, 1600 and 8800 are supposed to be and how much need to be added to the .15 and .25.
It would also help to know some input for test that you have the answer to.
I tend to agree with ar2007 that line 63 has no real logic to it, but it still works because those variables were initialized to zero when defined. It is a quick and dirty way to catch the variable that has a value. It is there and I would not bother with it for now.
I agree with ar2007's edit on "tax_rate_1" etc. and the use of "tax" which would eliminate line 63 and cause a change in line 65 form "total_tax" to just "tax".
I am not sure who's formulas would work best yours or ar2007's. This is where some known test data and answers would come in handy.
As I looked over the definitions of the different "tax_rate"s I could not figure any use for the large numbers you are adding. Once I removed them it made better sense. The 0.10, 0.15 and 0.25 make more sense and a more acceptable answer.