hey guys, i have to do this program and i'm having trouble with prompting 2 things outside the loop.

Write a program that lets the user enter the loan amount and loan period in number of years and displays the monthly and total payments for each interest rate starting from 5% to 8%, with an increment of 1/8.

Example: If you enter the loan amount 10,000 for 5 years; display a table as follows:

Loan Amount: 10000

Number of Years: 5

Interest Rate Monthly Payment Total Payment

5% 188.71 11322.74

5.125% 189.28 11357.13

5.25% 189.85 11391.59

...

7.85% 202.16 12129.97

8.0% 202.76 12165.83

This is what I have so far

```
import javax.swing.JOptionPane;
public class Loans
{
public static void main(String[] args);
{
double rate;
double monthlyPayment;
double loanAmount;
double total;
int numberOfYears;
//rate
// Need to prompt for the loan amount, outside the loop
// Need to prompt for the number of years outside the loop
for(rate = 5.0; rate <=8.0; rate=rate + 0.125)
{
// Enter Loan Amount
String loanAmountString = JOptionPane.showInputDialog("Enter loan amount:");
// convert rate to monthlyrate
// monthlyrate = rate / 1200; // 12 for the number of months and 100 to make a percentage
// calculate monthly payment
// monthlypayment = loanAmount * monthlyrate / ( 1 - 1 (Math.pow(1 + monthlyrate, numberOfYears * 12));
// display monthly payment
// calculate yearly payment
// yearly = monthlypayment * 12;
```

**if anyone could help i would really appreciate it.

*Edited 6 Years Ago by peter_budo*: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)