Results 1 to 3 of 3
Thread: Loop not working
- 11-07-2011, 11:32 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 13
- Rep Power
- 0
Loop not working
For some reason my loop will not, well loop. I just get the print out of the first value in the loop.
Java Code:int counter; for(counter=1; counter<=yearToUse*12; counter++);{ monthlyInterest = (balance*monthlyRate); if(counter == yearToUse*12){ monthlyPayment = balance+monthlyInterest;} monthlyPrincipal = (monthlyPayment - monthlyInterest); balance = (balance - monthlyPrincipal); System.out.println("Counter is " + counter + "Interest: " + (nf.format(monthlyInterest)) + " Principal: " + (nf.format(monthlyPrincipal)) + " Balance: " + (nf.format(balance)));
- 11-07-2011, 11:35 PM #2
Re: Loop not working
Take a very close look at line 2, the for statement. Can you see what should/should not be there?
- 11-07-2011, 11:36 PM #3
Member
- Join Date
- Nov 2011
- Posts
- 13
- Rep Power
- 0
Similar Threads
-
for loop not working properly
By lbgladson in forum New To JavaReplies: 8Last Post: 10-15-2011, 01:33 AM -
Scanner user input not working in conjunction with while loop.
By TheNadz in forum New To JavaReplies: 5Last Post: 11-27-2010, 04:49 AM -
Why isn't this while loop code working
By GreenTea in forum New To JavaReplies: 16Last Post: 11-10-2010, 04:14 AM -
while loop not working
By RBNSN83 in forum New To JavaReplies: 6Last Post: 06-21-2010, 08:29 AM -
Java mail problem(working in intranet,but not working in iternet)
By sundarjothi in forum Advanced JavaReplies: 8Last Post: 05-28-2008, 08:00 AM
Bookmarks