Purchase Solution

Mortgage Calculator

Not what you're looking for?

Ask Custom Question

The mortgage calculator must display the mortgage payment amount given the amount of the mortgage, the term of the mortgage, and the interest rate of the mortgage. This program must have hard code amount = 200,000, term = 30 years, and the interest rate = 5.75%. Must have strings to declare the variables.
_________________________________________________________________________

{
public static int defaultYears = 30;
public static float defaultLoanAmount = 200000;
public static float defaultInterestRate = 0.0575;

private int Years;
private float LoanAmount;
private float InterestRate;
private float MonthlyPayment;

public MortgageCalculator(){
Years = defaultYears;
LoanAmount = defaultLoanAmount;
InterestRate = defaultInterestRate;
}

public MortgageCalculator(int years, float LA, float IR){
Years = years;
LoanAmount = LA;
InterestRate = IR;
}

public int GetYears(){
return Years;
}
public void SetYears(int Years){
this.Years = Years;
}

public float GetLoanAmount(){
return LoanAmount;
}
public void SetLoanAmount(float LoanAmount){
this.LoanAmount = LoanAmount;
}

public float GetInterestRate(){
return InterestRate;
}
public float SetInterestRate(float InterestRate){
this.InterestRate = InterestRate;
}

public float GetMonthlyPayment(){
return MonthlyPayment;
}

//using the equation to calculate the monthly payment
Public void CalcMonthlyPayment(){
MonthlyPayment =
LoanAmount * (InterestRate / (1 - (InterestRate + 1) - 12 * Years)
}

//To convert a float value into a string,
public string ToString (float value){
return Float.toString(value);
}

//display the monthly payment, since the actually display is related to the UI //design which isn't required here, so this function only convert the //MonthlyPayment from numeric format to a string.
public string DisplayMonthlyPayment(){
return ToString(MonthlyPayment);
}
}
_________________________________________________________________________
How do I fix these errors?
init:

deps-jar:

Created dir: C:Documents and SettingsJason MollettJavaApplication3buildclasses

Compiling 1 source file to C:Documents and SettingsJason MollettJavaApplication3buildclasses

C:Documents and SettingsJason MollettJavaApplication3srcjavaapplication3Main.java:1: 'class' or 'interface' expected

{

C:Documents and SettingsJason MollettJavaApplication3srcjavaapplication3Main.java:51: illegal character: 8211

LoanAmount * (InterestRate / (1 - (InterestRate + 1) - 12 * Years)

C:Documents and SettingsJason MollettJavaApplication3srcjavaapplication3Main.java:51: illegal character: 8211

LoanAmount * (InterestRate / (1 - (InterestRate + 1) - 12 * Years)

3 errors

BUILD FAILED (total time: 0 seconds)

Purchase this Solution

Solution Preview

/*
* MortgageCalculator.java
*
*/

public class MortgageCalculator {
public static int defaultYears = 30;
public static float defaultLoanAmount = 200000;
public static float defaultInterestRate = (float)0.0575;

private int Years;
private float LoanAmount;
private float InterestRate;
private float MonthlyPayment;

/** Creates a new instance of MortgageCalculator */

public MortgageCalculator(int years, float LA, ...

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.