InvestmentRunner.java.html

  1  /**
  2     This program computes how much an investment grows in
  3     a given number of years.
  4  */
  5  public class InvestmentRunner
  6  {
  7     public static void main(String[] args)
  8     {
  9        final double INITIAL_BALANCE = 10000;
 10        final double RATE = 5;
 11        final int YEARS = 20;
 12        Investment invest = new Investment(INITIAL_BALANCE, RATE);
 13        invest.waitYears(YEARS);
 14        double balance = invest.getBalance();
 15        System.out.printf("The balance after %d years is %.2f\n", 
 16              YEARS, balance);
 17     }   
 18  }