0

I'm running into a roadblock on my program and the deadline is Tuesday(9/14). I'm at work all day and I'm hoping the interwebs can help me while I'm away (i can check @ lunch). I'm very new to Java and I'm still trying to digest the terminology so any clear explanations are greatly appreciated.

The Questions/Problem:

1. I would like to know how to ask the user to compare another loan. (I'm guessing/hoping it's just one more line of code)

2. How to redisplay the totals from each loan entered as noted at the below of the post: (the program needs to compare all the loans entered, these are the comparisons)

The totals needed are;

- how many months it took to pay off the loan
- original principal
- payment amount
- Interest Rate
- Total Interest Paid

3. The current code is giving me the error "cannot find symbol variable totalInterestPaid on line 46"

```
import javax.swing.JOptionPane; //importing all of the joptionpane's
public class LoanCompare{
public static void main (String[ ] args)
{
boolean run = true;
while(run)
{
double monthlyPaymentAmt= Double.parseDouble(JOptionPane.showInputDialog("How much can you pay per month?(eg. $250 put 250)")); // how much the user can afford to pay per month
double loanAmt = Double.parseDouble(JOptionPane.showInputDialog("How much is the loan for? (eg. $15,000 put 15000)")); // how much the loan is for
double interestPercent = Double.parseDouble(JOptionPane.showInputDialog("What is the interest rate of the loan? (eg. 15% put 15)")); // percent of interest expected to pay
int increment = 0;
System.out.println("Payment # Principal Payment APR MR Interest Payment Principal Payment\n");//Prints the header
while(loanAmt>0)
{
double principalAmt = 0;// initialize pricipal
double monthlyIR = (interestPercent / 1200); // the monthly interest rate, a static amount
double interestPayment = ( loanAmt * monthlyIR); // amount paid towards the interest each month
double totalInterestPaid = interestPayment++; //calculation for total interest paid
double principalPayment = (loanAmt - interestPayment);// Principal payment column
System.out.printf("%5d %12.2f %9.2f %6.2f %5.2f %12.2f %17.2f\n", increment,principalAmt,monthlyPaymentAmt,interestPercent,monthlyIR,interestPayme
nt,principalPayment);
loanAmt-=principalPayment; //loanAmt-=principal
increment++;
}
System.out.printf(" Total Interest Paid%9.2f\n\n", +totalInterestPaid); //Prints Total Interest Paid
}
//need to figure out how to prompt user for another pass
}
}
```