Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 0.43 KB  |  hits: 14  |  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. I have an array where I need to get the length and it's giving me trouble
  2. double[] x = { 11.11, 66.66, 88.88, 33.33, 55.55 };
  3.        
  4. public static double computeAverage(double[] x){
  5.  
  6.         double xTotal = 0.0;
  7.  
  8.         for (int i = 0; i < x.length(); i++)
  9.         {
  10.             xTotal = xTotal + x[i];
  11.         }
  12.         double computeAverage = xTotal / x.length();
  13.         return computeAverage;
  14. }
  15.        
  16. for (int i = 0; i < x.length; i++)
  17. {