Average
i don't know how to
calaculate and returns the average(in floating point) of the elments in an int array...
this is what i have so far:
public class O
{
public O()
{
int a[] = { 7, 8, 9, 9, 8, 7 };
{
System.out.print(average(a));
}
}
/**
* method count that uses for_each loop
*
*/
public int average (int a [])
{
int x = 0;
int total = 0;
for(int i : a ){
x++;
total = total + i;
}
return total / x;
}
}

