:confused:

I am tryng to write a program that will calculate:

interest, and monthly payment.

The program should output the number of months it wold take to repay the loan.

Principle is 1000

Monthly payment is $25

interest rate per month is 7.2/12=.6%

Problems:

My program is in a loop

My mind is in aloop. I have thoroughly confused myself.

Please help. Please turn me around. :confused:

Code:`import java.util.*;`

import javax.swing.JOptionPane;

public class MonthlyPmts {

public static void main(String[] args){

/* Declaring the variables that will be used in the problem */

String loanAmt;

String intPerYr;

String monthlyPmt;

double interest;

double principal = 1000;

double intRateMon = .06;

double monPay = 25;

while (principal <= 1000)

{

/* Perform the calculations */

interest = (principal * intRateMon);

monPmt = (principal - interest - monPay);

}

/* Input Dialog boxes */

loanAmt = JOptionPane.showInputDialog

("Enter the loan amount: ");

intPerYr = JOptionPane.showInputDialog

("Enter the interest rate per year: ");

monthlyPmt = JOptionPane.showInputDialog

("Enter the monthly payment: ");

}

}