title: Calculating interest rate in java
body: <p>I'm making a method that are supposed to calculate the interest rate of an amount over a certain period of years (these values are already defined in the parameters).
  This is the code i have so far:</p>
  
  <pre><code>    public void balance(int amount, double rate, int year){
      double yearlyRate = amount * rate;
      double totalAmount;
  
  
      System.out.print(amount + " :- " + " grows with the interest rate of " + rate);
  
      for (int i = 0; i &lt;= year; i++ ){
  
            for ( int j = amount; j)
                totalAmount = amount + yearlyRate;
                System.out.println(i + "   " + totalAmount);
      }
  
  }
  </code></pre>
  
  <p>I was on my way to make the nested for-loop as you can see there where there is missing code. Here i ran in too some trouble. The first for-loop runs through the years and the other are supposed to calculate the total amount. To be clear the years that are defined in the variable "int year" let's say that it is 7, then the program are supposed to calculate the growth of the amount each year so:</p>
  
  <pre><code>year1 totalAmount 
  year2 totalAmount 
  year3 totalAmount 
  and so on.....
  </code></pre>
  
  <p>The main method looks like this: </p>
  
  <pre><code>public void exerciceG(Prog1 prog1) {
      System.out.println("TEST OF: balance");
      prog1.balance(1000, 0.04, 7);
  }
  </code></pre>
  
  <p>I appreciate any help i can get!</p>