Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By JosAH

Thread: Help

  1. #1
    hawk-dc is offline Member
    Join Date
    Nov 2013
    Rep Power

    Default Help

    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

    import java.util.Scanner;
    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(;
    amount = kbd.nextDouble();
    System.out.println("Your investment in 10 years will be: ");

    for (int i = 0 ; i < 10; i++)
    amount = amount * (1 + apr);



  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Help

    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%)

    kind regards,

    hawk-dc likes this.
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    kneitzel is offline Senior Member
    Join Date
    Feb 2014
    Rep Power

    Default Re: Help

    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.

    Kind regards,


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts