title: Noob issue. I have doubles stored in ArrayList. Having difficulty adding their total to a single double variable.
body: <p>Simply put, the program is find the average value of doubles entered until a negative number is entered. I'm just receiving an error at the kk += numbers[z];</p>
  
  <pre><code>    double kk = 0;
      System.out.println("Enter a series of numbers; entering a negative number will quit the program.");
      System.out.println("The resulting average value will be returned");
      Scanner scan = new Scanner(System.in);
      List&lt;Double&gt; numbers =  new ArrayList&lt;&gt;();
  
      while (scan.hasNextDouble()){
          if (scan.nextDouble() &gt;= 0)
              numbers.add(scan.nextDouble());
          else
              System.exit(0);
      }
  
      for (int z = 0; z &lt; numbers.length; z++){
          kk += numbers[z];
          double ave = kk / numbers.length;
      }
      System.out.println(ave);
  </code></pre>