Solved

Expected error

Posted on 2006-06-24
1
205 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
Comment Utility
Add the following at the very end of the file:

}
}
}
}




(You haven't closed all openning braces)
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Visual xHarbour 1 74
parentbit challenge 3 51
pairs challenge 5 44
C# code editing and collaboration 3 39
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This article will show, step by step, how to integrate R code into a R Sweave document
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 …
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…

771 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

15 Experts available now in Live!

Get 1:1 Help Now