I keep getting this error code on the code I wrote up for the array assignment in pgr.
C:\Users\niffer\Desktop\weekfour.java:49: error: reached end of file while parsing
}
^
1 error
Tool completed with exit code 1
I have looked over the code and can not see where the brackets are not correct.
Any body else have a second eye that can see where this error is coming from.
Would appreciate the help..........I have been struggling with this class more then any.
I Googled the code and just kept getting I need to check the brackets.
Changed them out over and over and still having hard time see the mistake I made.
/**
Programmer: Jennifer Mercer
Date: 12/05/2011
Course: PRG/420
File: Calculator.java
Requestor: Dwain Hammer Billings MT
Request Description:
Write the program in Java (without a graphical user interface) and have it calculate the payment amount for 3 mortgage loans:
- 7 year at 5.35%
- 15 year at 5.5%
- 30 year at 5.75%
Use an array for the different loans. Display the mortgage payment amount for each loan.
Reference for JavaScript:NScraps. (2011). Retrieved from http://nscraps.com/Java/768-program-calculate-mortgage-payments-java.htm
*/
import java.math.*;
import java.text.*;
public class Calculator {
public static void main(String[] arguments) {
//Array method for payments
double principal= 200000; //Loan Amount
double []years= {7,15,30}; // Term of years
double []interest={0.0535,0.055,0.0575}; // Interest for loans
DecimalFormat df = new DecimalFormat("$###,###.00"); //Formatting the output
//Calculations for mortgage calculator
//for each term and Rate starting from the first location of each array terms[] and Rates[]
for (int i=0;i<terms.length;i++){
//Calculates the Payment per month to be paid under mortgage scheme One
interestRate=Rates; //take value from the array Rates[] to a temporary variable
term=terms; //take value from the array terms[] to a temporary variable
double monthlyRate = (interestRate/12); //derive the monthly interest rate
//calculate the discount factor
double discountFactor = (Math.pow((1 + monthlyRate), term) -1) / (monthlyRate * Math.pow((1 + monthlyRate), term));
double payment1 = loan / discountFactor; //calculate payable amount per month
//Output for mortage scheme One
System.out.println("The Loan amount is:"+df.format(loan)+"\n");
System.out.println("The interest rate is:"+interestRate*100+"%");
System.out.println("The term of the loan is:"+term/12+" years.");
System.out.println("Monthly Payment Amount: " + df.format(payment1)+"\n");
}