Solved

Expected error

Posted on 2006-06-24
1
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
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…
Progress

623 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