Im trying to return the variable val and print the future value out without using a print statement, the complier says it's good but wont return the value.
import java.util.Scanner;
public class FutureValues{
public static Scanner scan = new Scanner( System.in);
public static void main(String[] args){
double currentAmount = scan.nextDouble();
double rate = scan.nextDouble();
double year = scan.nextDouble();
FutureValue(currentAmount,rate,year);
}
public static double FutureValue(double p, double r, double y){
double rate = r/100.0;
double fv = p*(1 + rate);
double val = Math.pow(fv,y);
return val;
}
}