Using variables in a loop

Code:

`import javax.swing.*;`

public class MortgageApp2 {

public static void main(String args[])

{

String loanamt,

interest_peryr,

yearstot,

pay_amt;

double loan,

interest_yr,

years,

interest_mo,

loan_pmts,

payments,

new_balance,

old_balance,

interest,

principle,

payamt,

balance;

loanamt= JOptionPane.showInputDialog("Enter Loan Amount");

interest_peryr=JOptionPane.showInputDialog("Enter the Interest Percentage: Example 5.6");

yearstot=JOptionPane.showInputDialog("Enter Loan Period in Years");

loan=Double.parseDouble(loanamt);

interest_yr=Double.parseDouble(interest_peryr);

years=Double.parseDouble(yearstot);

interest_mo = interest_yr/12/100; // Turns percent whole numbers into decimals

loan_pmts= years * 12;

payments = (loan*interest_mo/(1- Math.pow((1+interest_mo),-loan_pmts)));

JOptionPane.showMessageDialog (null, "Your payment is: $ " + payments);

principle= payments - (loan *interest_mo);

JOptionPane.showMessageDialog(null, "your prinicple paid is: $ " + principle);

interest= payments-principle ;

JOptionPane.showMessageDialog(null, "your interest paid is: $ " + interest);

for(int month=yearstot ;month<=(yearstot*12);month++){

}

System.exit(0);

}

}

So in the last line of my code i am trying to call the years of the loan entered by the user to do a loop in months, so it would be year * 12 so i can get the total amount of months to increment the loop, and then from there i want to add the calculation to do principle and so on, but how do i get the loops to run bu using user defined years?

Thanks!!

:(-: