Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: MA1779 on Aug 17th, 2011  |  syntax: None  |  size: 0.53 KB  |  hits: 51  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.ArrayList;
  2.  
  3.     public class ArrayDemo
  4.          {
  5.          public static void main(String[] args)
  6.     {
  7.            double avaerage;
  8.                 avaerage = calcualteAvaerage();
  9.                
  10.                 System.out.println("The Average is " +average);
  11.                
  12.          }
  13.          
  14.          public static double calcualteAverage()
  15.          {
  16.              double[] numbers = (2.0, 3.5, 6.9, 8.25, 12.5);
  17.                   double total = 0;
  18.                   double average;
  19.                   for (int index = 0 index<numbers.lentgh; index++)
  20.                       total+= numbers(index);
  21.                   average = total/numbers.length;
  22.                   return avaerage;
  23.          }
  24. }