Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Why is my program hanging

Avatar of cduggins
cduggins asked on
17 Comments1 Solution320 ViewsLast Modified:
I am new to Java and working in this program and for the life of me I can not understand why my program is handing at the Declare 3 new varibles and not running after that:

import java.text.DecimalFormat;

public class mortgage
   public static void main (String[] args)
//Declare Varibles
double interest,payment;
int amount,term;
DecimalFormat decimalPlaces=new DecimalFormat("0.00");

//Set interest, amount and term
double interest = .0575;
double monthlyPayment = 0;

//Calculations for Mortgage Payment

//Print the monthly payment to the screen

System.out.println("Duggins Mortgage Calculator");
System.out.println("intrest rate="+interest*100);
System.out.println("Number of payments="+term*12);
System.out.print("Monthly Payment= $");

//Declares and builds three new variables
double loanBalance = 0;
double interestPaid = 0;
int lineCount = 20;
loanBalance = loanAmount - monthlyPayment;

//Starts loop statement,and declares formula for loan balance and interest paid
while (loanBalance > 0) {

//Displays the loan balance and interest paid
System.out.println("The loan balance is: $" + loanBalance);
System.out.println("The interest paid on the loan is: $" + interestPaid);

loanBalance = loanBalance - monthlyPayment;
interestPaid = monthlyPayment * interest;

//Pauses screen
if (lineCount > 0) {
try {
} catch (InterruptedException e) {
//Stops loop statement
if (loanBalance <= 0) {
System.out.println("The loan balance is: $0.00");
Avatar of ADSLMark

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 17 Comments.
See Answers