Hacker News new | ask | show | jobs
by chenster 576 days ago
Good catch. The total discount should be divided by 100. I missed that. :) Fixed now.
1 comments

Slow down :)

- In one case you write (p/100) and in the other (totalDiscount/100). It wouldn't matter because the end result is the same mathematically, but the apparent meaning is different. But anyway...

- Now the calculated total price is 30, but it should be 70. totalPrice = basePrice * (1 - totalDiscount/100)