Finding the percentage component?

Started by
3 comments, last by sandy 18 years, 8 months ago
Ok, I'm having a bit of a problem with my billing component for my latest project. I need to account for tax and the chance that the tax might change. At the moment, the tax is 10%. So, if I have a cost of $100 and I add 10% percent to it, it becomes $110. Then if I want to reverse it and find the tax component of $110, I just divide it by 11, to give $10. Now what happens if the tax was to change to something other than 10%. Adding the tax on is not a problem as I just take $100 and add whatever percentage it is. So 7% would be $107 and 12% is $112. The problem I'm having is I don't know how to reverse it if the tax changes to anything other than 10%. So if I had a price of $112 and a tax rate of 12%, how would I extract the tax value from the price? P.S. This is not H/W! I haven't been to school in almost 10 years. This is a genuine problem.
Advertisement
total = BasePrice + BasePrice * tax

total = BasePrice (1+tax)

total / (1+tax) = BasePrice
What you have to understand is that $112 is is also 112% of the orignal price. so if you divided it by 112 you would get 1 percent of the price, then you could multiply it by 12 to get the twelve percent (or 100 to get 100 percent e.g. the original value).

112/112 = 1
1* 12 = 12
12 <- tax value.

Hope that is an ok explination :)
Quote:Original post by BosskIn Soviet Russia, you STFU WITH THOSE LAME JOKES!
The previous posters are correct, but here is your answer:

tax = total * rate / (1 + rate)

For a 12% tax, multiply the total by .12/1.12 and for a 7% tax, multiply the total by .07/1.07.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Thank you all very much. You have been extremely helpful... You can all consider yourself rated :)

This topic is closed to new replies.

Advertisement