PDA

View Full Version : Need assistance with some calculations:


Dokins
16/04/2014, 03:14 PM
Basically I'm trying to calculate the rate of inflation to apply that to everything in my server so:


Say the total amount in the server this month is: $1000.

Next month it's $2000.

That's a 100% increase, right?

How do I add that to each item. I.e

Say a cellphone costs $100, How do I add the rate of inflation to that amount if it's $100 increase? Would it be $200 now instead of $100?

How do I actually calculate it in code?

Evocator
16/04/2014, 03:27 PM
Ok basically to get an increase in percentage you need an equation which is

Inflation Rate = ((Current Value - Starting Value) / Starting Value) * 100

Now for getting each item's value as an increase, you should

New Item Value = (Current Item Value) * Inflation Rate / 100

EDIT: Missed something in the equation

Dokins
16/04/2014, 03:36 PM
PERFECT.

Thank you + REP.