0

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;
  }
}
Luis Valdes
  • 37
  • 1
  • 5
  • 5
    Please explain _print the future value out without using a print statement_. – Sotirios Delimanolis Sep 29 '17 at 20:42
  • you're calling: `FutureValue(currentAmount,rate,year);` from main - but you're not saving the returned result anywhere (nor printing it). – Nir Alfasi Sep 29 '17 at 20:43
  • 3
    "print ... without using a print statement" sounds like this belongs to https://codegolf.stackexchange.com/ – Mick Mnemonic Sep 29 '17 at 20:44
  • You have to use `print` in some form. You could probably wrap the stdout in some other stream wrapper, and define your own `print`, but at *best* it would be doing the same thing. – Carcigenicate Sep 29 '17 at 22:05

0 Answers0