I keep getting the following error:
Exception in thread “main” java.lang.Error: Unresolved compilation problem:
Syntax error, insert “}” to complete ClassBody
at Project2.main(Project2.java:17)
Except I have all the curly brackets and don’t seem to be missing one, so why do I keep getting this?
Here is my code:
import java.util.*;
public class Project2 {
public static void main(String[] args){
//create scanner
Scanner sc = new Scanner(System.in);
//user input investment amount
System.out.print("Enter the amount invested: ");
double investmentAmount = sc.nextDouble();
//user input interest rate
System.out.print("Enter the annual interest rate: ");
double monthlyInterestRate = sc.nextDouble();
//# of years(30)
int years = 30;
//call method
futureInvestmentValue();
}
public static double futureInvestmentValue(investmentAmount, monthlyInterestRate, years){
//futureInvestmentValue = investmentAmount*(1 + monthlyInteresRate)^(numberOfYears*12)
//can return a double value
double pow = 30*12;
double a = 1 + monthlyInterestRate;
double b = pow;
for(int i = 0; i < 30; i++){
double[] numYears = new double[i];
}
for(int j = 0; i < 30; j++){
double [] fIV = new double[30];
j = investmentAmount * Math.pow(a, b);
}
return i;
return j;
}
}