Adding iterations together in Java

In order to keep on adding the salary for each day and keeping the track of total for each day (as I get it from your statement), you can change:-

total = amount * .01 * amount;


total += amount * .01 * amount; // total = total + (amount*0.01*amount)

which(when not printing each day information separately) can be simplified as:-

total = amount * .01 * amount * days;

Browse More Popular Posts

Leave a Comment