Hopefully someone can help me...I'm a student taking my first Java class. We are working on classes (building them). For this assignment the teacher gave us a test program that we have to build a class for to computer some basical mortgage calculations. Below is the class I built that is being passed variables from the end-user and is supposed to return some calculations. No matter what I try I keep getting an error
- Exception in thread "main" java.lang.NoSuchMethodError: MortgageCalcs.futureValue()D at
TestMortgage.main(TestMortgage.java:28)
Like I said...he gave us TestMortgage...
public class MortgageCalcs
{
private double rate; //All of these private statments are decleration of variables
private double term;
private double principal;
private double calcPayment;
private double futureValue;
private double intCharge;
private double r;
private double x;
private double y;
private double temp;
public MortgageCalcs (double interestRate, double term, double principal) //begining of the constructor that captures the data from method above
{
rate = interestRate; //assigns value to interest rate being fed by TestMortgage
term = term; //assigns value to term that is being fed by TestMortgage
principal = principal; //assigns value to principal that is being fed by TestMortgage
} //end of constructor
public double calcPayment (double principal) //method to calculate the value of monthly payment
{
r = rate/100; //calculation of variable r as provided in instructions
x = 1.0+r/12.0; //calculation of variable x as provided in instructions
y = term*12.0; //caluclation of variable y as provided in instructions
temp = (1.0/Math.pow(x,y)); //calculation of variable temp as provided in instructions
calcPayment=(principal*r/12.0)/(1-temp); //calculation of payment based on the formula given in instructions
return calcPayment;
}
public double futureValue (double calcPayment, double term) // method to calculation of futureValue
{
futureValue=calcPayment*term*12;
return futureValue;//
}
public double intCharge (double futureValue, double principal)
{
intCharge=futureValue-principal;
return intCharge;
}
}