calculating interest on a certificate of deposit
<p>I'm working on a program that will calculate the basic interest accrued on a certificate of deposit. The program asks for the amount of money invested and the term (up to five years). Depending on how many years their term is, is what determines how much interest is earned. I use an if/else statement to determine the rate of interest. I then use a loop to print out how much money is in the account at the end of each year. My problem is that when I run the program, the money is not counting. </p>

<p>Here is the entire code. </p>

<pre><code>import java.util.Scanner;

public class CDCalc
{
    public static void main(String args[])
        {
            int Count = 0;
            double Rate = 0;
            double Total = 0;


            Scanner userInput = new Scanner(System.in);

            System.out.println("How much money do you want to invest?");
            int Invest = userInput.nextInt();

            System.out.println("How many years will your term be?");
            int Term = userInput.nextInt();

            System.out.println("Investing: " + Invest);
            System.out.println("     Term: " + Term);

            if (Term &lt;= 1)
            {
            Rate = .3;
            }

            else if (Term &lt;= 2)
            {
            Rate = .45;
            }

            else if (Term &lt;= 3)
            {
            Rate = .95;
            }

            else if (Term &lt;= 4)
            {
            Rate = 1.5;
            }

            else if (Term &lt;= 5)
            {
            Rate = 1.8;
            }


            int count = 1;
                    while(count &lt;= 5)
                {

                    Total = Invest + (Invest * (Rate) / (100.0));

                    System.out.println("Value after year " + count + ": " + Total);
                    count++;
                }       
        }
}
</code></pre>

<p>and here is the result I get with a 10 dollar investment, just to keep it simple, and a 5 year investment.  </p>

<pre><code>How much money do you want to invest?
10
How many years will your term be?
5
Investing: 10
     Term: 5
Value after year 1: 10.18
Value after year 2: 10.18
Value after year 3: 10.18
Value after year 4: 10.18
Value after year 5: 10.18
</code></pre>

<p>My main problem is I dont know how to make it continually add the intrest onto the total. I'm not sure if I need to use a different loop or what. Any help would be appreciated. </p>
