jeudi 5 mars 2015

In Java, how to apply interest on certain amount of the total amount

I have a problem to solve in Java. Basically, I have to calculate how many KWH customer has had spent last month till today. From 0-300 KWH it is $5 total. From 301 to 1000kwh it is $5 for first 300kwh and then each kwh is $0.03 extra. from 1001 and above it is $0.02 extra for each kwh. I am not sure how to apply those 0.03 and 0.02 on each kwh after 300kwh. Thanks.


Aucun commentaire:

Enregistrer un commentaire