Jump to content
  • Advertisement
Sign in to follow this  
sandy

Finding the percentage component?

This topic is 4774 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
total = BasePrice + BasePrice * tax

total = BasePrice (1+tax)

total / (1+tax) = BasePrice

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Thank you all very much. You have been extremely helpful... You can all consider yourself rated :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!