Hey here's the small project... but how can I return the value (amount) in 10 years ? The way I did, the program just doesnt return anything
public class FutureValue
public static void main (String args)
double amount = 0;
double apr = 0;
System.out.println("How much money would you like to invest?");
Scanner kbd = new Scanner(System.in);
amount = kbd.nextDouble();
System.out.println("Your investment in 10 years will be: ");
for (int i = 0 ; i < 10; i++)
amount = amount * (1 + apr);
A few remarks: the interest is 0% so after ten years, the invesment will be the same as when it started; you put all your code in the main( ... ) method; it's a void method so it can't return anything. hint: set apr to, say, 0.02 (2%)
I think you meant no output when you said that it is not returning anything.
So if you want output, you should add it. So after the for loop you could print the new amount with System.out.println.