Solved

Expected error

Posted on 2006-06-24
1
209 Views
Last Modified: 2010-04-17
My program will not compile because of an "expected error". I can't find the problem. Please review.

/*
* Mortgagecalculator.java
* Version 2.0
* To calculate and display the mortgage of the hard coded terms
* amount = $200,000, the term = 30 years, and the interest rate = 5.75%
* Then displays loan balance and interest paid on loan until loan amount is equal
* to zero
*/

public class MortgageCalculator3{

public static void main(String[] args){
//Declares and builds the variables
int loanAmount = 200000;
int loanTerm = 360;
double interest = .0575;
double monthlyPayment = 0;

//Displays the mortgage calculator
System.out.println("Mortgage Calculator");
System.out.println("The loan amount is $200,000");
System.out.println("The term of the loan is 30 years");
System.out.println("The interest rate applied to the loan is 5.75%");
System.out.println();


//Declares formula
monthlyPayment = (loanAmount*(interest/12)) / (1 - 1 /Math.pow((1 + interest/12), loanTerm));

System.out.println("The monthly payment is: $" + monthlyPayment);
System.out.println();

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

//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);
//Pauses screen
if (lineCount < 0) {
lineCount--;
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
}
//Stops loop statement
if(loanBalance <= 0) {
System.out.println("The loan balance is: $0.00");
}
0
Comment
Question by:jjbraxton
1 Comment
 
LVL 25

Accepted Solution

by:
InteractiveMind earned 500 total points
ID: 16976101
Add the following at the very end of the file:

}
}
}
}




(You haven't closed all openning braces)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question