3
$\begingroup$

I had posted this question on stack overflow because I am trying to implement a method that will loop through a set of percentages and add or remove them to a value based on some properties that are set. Here is a link to the question. I believe I have the compounding part correct. I partially have the non-compounding part, the problem is that I need to add just 1 to the very end instead of every time through the loop. The other issue I am facing is how do I mix compounding and non-compounding in the formula. Basically, I have the following scenarios:

All percentages are compounded and removed from the total.
All percentages are non-compounded and removed from the total.
All percentages are compounded and added to the total.
All percentages are non-compounded and added to the total.
All percentages are compounded, but some are removed and some are added.
All percentages are non-compounded, but some are removed and some are added.
Some percentages are compounded and some are non-compounded, but they are all added.
Some percentages are compounded and some are non-compounded, but they are all removed.
Some percentages are compounded and some are non-compounded, and they could be removed or added.

I believe I covered everything.

Thanks for the help

1 Answers 1

1

What base are the non-compounded ones taken on? For example, assume a 100 base price, a +3% and -6% compounded, a +10% and -8% non-compounded tax. If the non-compounded taxes are on the base you just get $100\cdot1.03\cdot0.94+100\cdot0.10-100\cdot0.08=100(1.03\cdot0.94+0.10-0.08)$ for a final price or $100(1.03\cdot0.94+0.10-0.08)-100$ for the total tax. Is this what you are after?

  • 0
    I just made it up on the fly, but I get 98.82 for the final price, or a tax of -1.182011-04-14