0

I cannot make my code loop.... Anyone please help!

```
/*
PRG420
Week 2 Individual Project
Amanda Cornwell
September 10, 2007
MortgageProgramCornwell.java
This program will calculate and display the
monthly mortgage payment amount, given the amount
of the mortgage, term of the mortgage, and the intrest
rate of the mortgage.
Next, the program will display the monthly mortgage payment
amount. Then, list the loan balance and interest paid for
each payment over the term of the loan. It should also
hesitate during displaying the list.
*/
import java.io.*;
import java.text.DecimalFormat;
import java.text.*;
public class MortgageProgramCornwell
{
public static void main(String[] args) throws IOException
{
//constants
int principal = 200000;
float fraction = 0;
int months = -360;
double monthlypayment = 0;
//calculation
fraction = (float) 575 / 120000;
index= (float) principal * ((fraction / (1-(Math.pow((1+fraction),(months))))));
DecimalFormat df = new DecimalFormat ("####.##");
// output
System.out.println("The Principal is " + principal);
System.out.println("The Intrest Rate is 5.75%");
System.out.println("The Number of Years is 30 years");
System.out.println("The Monthly Payment is " + (df.format(monthlypayment)));
//constants
double monthly_principal=0;
double monthly_interest = 0;
double remainbalance= 0;
int lineCount= 20;
remainbalance= (principal - monthly_principal);
while(principal > 0)
System.out.println("Balance is " + (df.format(remainbal)));
System.out.println("Interest paid is $" + (df.format(monthly_interest)));
monthly_interest= (principal * fraction);
monthly_principal= (monthlypayment - monthly_interest);
//Pause Screen
if(lineCount > 0) {
lineCount--;
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
}
}
}
//Stops Loop
if(remainbalance <=0){
System.out.println("The loan balance is: 0.00");
}}
}
```

*Edited 3 Years Ago by happygeek*: fixed formatting