+ 1

Java Increment using percentage

Hello, I was wondering if there is a for loop that you can use to increment the price by 10%. Ex: First five items are free. After the 5th item the price increases by 10% (so 6 items = 110% fee, 7 items = 120% fee and so on) and stops charging when it more than the 10th item. (So, when it reaches 150%)

29th Mar 2022, 9:28 PM
anissa braca
anissa braca - avatar
2 Respostas
+ 4
loop from I=1 to 10{ if I>5 do price+10% if price >150% break } It's depends on how you implementing...
29th Mar 2022, 9:46 PM
Jayakrishna 🇮🇳
+ 1
Thank you for breaking it down like that!!!
29th Mar 2022, 10:32 PM
anissa braca
anissa braca - avatar