previous | start | next

File InvestmentTest.java

1 /**
2     This program computes how long it takes for an investment
3     to double.
4 */
5 public class InvestmentTest
6 {
7    public static void main(String[] args)
8    {
9       final double INITIAL_BALANCE = 10000;
10       final double RATE = 5;
11       Investment invest = new Investment(INITIAL_BALANCE, RATE);
12       invest.waitForBalance(2 * INITIAL_BALANCE);
13       int years = invest.getYears();
14       System.out.println("The investment doubled after "
15          + years + " years");
16    }   
17 }


previous | start | next