Solved

Need helping figuring out the error message I am getting on my Java Mortgage Calculator program.

Posted on 2011-03-19
1
340 Views
Last Modified: 2012-05-11
//Filename MortgageCalWk3_code
//Written by Jennifer Pike
//SR description: Write a program in Java (without GUI) using a loan amount of $200,000 wityh an interest rate of 5.75% over a 30 year term.
//Display the mortgage payment and then list the loan balance and interest paid for each payment over the term of the loan.
//If the list would scroll off the screen, use loops to display a partial list, hesitate, and then display more of the list.

import java.text.*;
import java.util.*;
public class mortgagePayment_wk3
{
public static void main(String[] args)
{
//declaration statements
int length=30; // 30 year mortgage
double Principal=200000.00; //Loan Amount
double InterestRate=5.75;
double monthly_payment = 0.00;
double monthly_principal= 0.00;
double monthly_interest = 0.00;
NumberFormat currency= NumberFormat.getCurrencyInstance
double y_rate = (rate /100/12);
double monthly_payment = balance * ( y_InterestRate / (1 - Math.pow((1+y_InterestRate),-1*(length*12) ) ));
y_InterestRate = (InterestRate/100)/12;
System.out.println("\t\tMortgage Payment Formula");
System.out.println("\t\tBalance own is $200,000");
System.out.println("\t\tYearly interest rate is 5.75%");
System.out.println("\t\tThe length of loan is 30 years\n");

// start of loop to calculate interest paid and balance owe
// print statement as balance increment,as interest increment
for (int mpi =1; mpi<=length*12; mpi++) { // months of payment being decrimented start counter
monthly_interest = (balance*y_InterestRate);
balance = (balance - monthly_Principal);
monthly_principal = (monthly_payment - monthly_interest);
System.out.println("Balance is $" + currency.format(balance));
System.out.println("Interest paid is $" + currency.format(monthly_interest));

try {Thread.sleep(10);} catch (InterruptedException e){}

}
}
}



1 error found:
File: C:\Mortgage\mortgagePayment_wk3.java  [line: 20]
Error: C:\Mortgage\mortgagePayment_wk3.java:20: ';' expected
0
Comment
Question by:Indy717
1 Comment
 
LVL 8

Accepted Solution

by:
crysallus earned 500 total points
Comment Utility
try:

NumberFormat currency= NumberFormat.getCurrencyInstance();

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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.
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

762 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

6 Experts available now in Live!

Get 1:1 Help Now