Unfortunately, your code is still not calculating simple interest correctly.
In 1676, the total amount
should be (approx.)
$275.22(I rounded up to the next cent but banks will always round down).
According to your program, the amount in 1676 is only
$84. If you owned a bank, you would have to answer to a lot of angry customers. This doesn't take into account the $1 that you mysteriously add afterwards (which gets overwritten in the next iteration).
Hint: do not do this:
totMoney ++;
In 1726, the total amount
should be (approx.)
$3156.03.
According to your program, the amount in 1726 is only
$144. Congratulations, you have just screwed your customer of 100 years out of $3012.03 :D
The problem with your formula is you are finding how much interest would be accrued on $24 in one year and multiplying it by how many years have passed. What you should do is implement Danny Toledo's formula:
Where P would be the total amount computed in the last iteration, (1+i) is 1.05, n is 50, and A is the total amount at the end of the present 50 year period (
Hint: set this to P in the next iteration).