else if (Balance <100)
Balance = 0;
count = count +1;
System.out.println("Balance at Month " +count+ " is " +Balance+ " after making a payment of " +MonthlyRepayment );
That's because you set MonthlyRepayment to 100 initially and then you never set the variable to anything else. If you want to continuously pay off 100 except when there is less than that amount remaining, calculate the amount remaining and then set MonthlyRepayment to that amount for the last payment.
BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354
Do it yourself!!
That was very rude.
You judge others when yourself have created 2 identical threads with the same question.
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
else if (Balance <100)
MonthlyRepayment = Balance;
Balance = 0;
count = count +1;
System.out.println("Balance at Month " +count+ " is " +Balance+ " after making a payment of " +MonthlyRepayment );
System.out.println();
All I added was MonthlyRepayment = Balance; if you don't understand why that should work, just ask.
BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354