Solved

Expected error

Posted on 2006-06-24
1
208 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 95
mapShare challenge 13 100
Export Table to CSV - Access to CSV - using python 18 133
Removing line numbers from left column in config file 7 49
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
This is an explanation of a simple data model to help parse a JSON feed
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now