I need to calculate the average value of the array and print it out. What am I doing wrong here?
public class Weight {
public static void main(String[] args) {
int[] value = {98, 99, 98, 100, 101, 102, 100, 104, 105,
105, 106, 105, 103, 104, 103, 105, 106, 107, 106,
105, 105, 104, 103, 102, 102, 101, 100, 102};
printArray(value);
}
public static void printWeightAVG(int[] value) {
double average = ((int)value / 28.0);
System.out.println("The average weight is " + average + " lbs.");
}
}
printArray(value)should beprintWeightAVG(value)as well as needing to iterate over the array itself