jjbraxton
asked on
Expected error
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("Mortga ge 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");
}
/*
* 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("Mortga
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))
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");
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.