title: add year + average rainfall from array
body: <p>I am told to <strong>Use nested for loops. The outer loop loops through the years. The inner loop will read and total each year's rainfall amounts and print the average of that year.</strong></p>
  <pre><code>public class Rainy {
  
  int years[] = {1, 2, 3};
  double rain1[] = {1.5, 2.5, 3.5, 4.5, 5.5, 2.0, 1.0, 1.0, 2.0, 2.5, 3.0, 1.5};
  double rain2[] = {1.0, 2.0, 3.0, 4.0, 5.0, 2.5, 1.5, 1.5, 2.5, 2.0, 3.5, 1.0};
  double rain3[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0};
  
  public void average(int[] data) {
      int sum = 0;
      double average;
  
      for(int i=0; i &lt; data.length; i++){
          sum = sum + data[i];
      }
      average = (double)sum/data.length;
      System.out.println(&quot;Average value of array element is &quot; + average);
  }}
  </code></pre>
  <p>but I am not sure of how to put years in there since the output is gonna be different from what he asks.
  this is what the output should look like</p>
  <blockquote>
  <p>The average for year 1 is 2.54.</p>
  </blockquote>
  <blockquote>
  <p>The average for year 2 is 2.46.</p>
  </blockquote>
  <blockquote>
  <p>The average for year 3 is 3.50.</p>
  </blockquote>
  <p>So isn't that just in the print??? perhaps I'm just misunderstanding</p>