QUOTE(nick2price @ 15 Sep, 2008 - 02:26 PM)

Right, compiled it and got some errors.
First one
Cannot find symbal variable nextLine;
Your calling up a java method here so your code should be
CODE
LengthofLoan = in.nextLine();
You forgot the ().
Second error is cannot find symbal variable INTERESTRATE
Thats because you have made a spelling mistake when you declared it.
Last error is oporator ^ cannot be applied to double,double
I havnt actally used ^ before. What are you trying to do here? Because the error is telling you that you cannot perform this mathematical operation on two doubles.
I went through it again and did find some errors. I have fixed them and compiled it. It works, but the forumla doesnot come out correctly
The formula that i am trying to work in is
monthly payment = [interest rate + (interest rate) / ((1 - interest rate ^ months) - 1] * amount of mortage loan + estimated escrow amount
CODE
import java.util.*;
public class MortagePayments2
{
public static void main(String[] args)
{
String AmountofMortageLoan;
String InterestRate;
String LengthofLoan;
String EstimatedEscrowAmount;
double MORTAGELOAN;
double INTERESTRATE;
double LENGTHOFLOAN;
double ESTIMATEDESCROWAMOUNT;
double MONTHLYPAYMENTS;
double RATE;
double PAYMENTS;
double LENGTH;
long MIDDLE;
Scanner in;
in = new Scanner(System.in);
System.out.print("Amount of Mortage Loan: ");
AmountofMortageLoan = in.nextLine();
System.out.print("Enter Interest Rate: ");
InterestRate = in.nextLine();
System.out.print("Length of Loan: ");
LengthofLoan = in.nextLine();
System.out.print("Estimated Escrow Amount: ");
EstimatedEscrowAmount = in.nextLine();
// Calculate and display Monthly Payments
MORTAGELOAN = Double.parseDouble(AmountofMortageLoan);
LENGTHOFLOAN = Double.parseDouble(LengthofLoan);
INTERESTRATE = Double.parseDouble(InterestRate);
ESTIMATEDESCROWAMOUNT = Double.parseDouble(EstimatedEscrowAmount);
LENGTH = LENGTHOFLOAN * 12;
RATE = INTERESTRATE / 1200;
MIDDLE = (long)(Math.pow(1 + RATE)^LENGTH))-1;
PAYMENTS = (RATE + (RATE/MIDDLE)* MORTAGELOAN) + ESTIMATEDESCROWAMOUNT;
System.out.println("Your Monthly Mortage Payments is:" + PAYMENTS);
}
}
Edited... please use the [ code] tags
This post has been edited by pbl: 15 Sep, 2008 - 03:47 PM