import java.util.Scanner;
public class AverageArrays{
public static void main(String[] args){
final int MAX_REPEAT = 5;
int i = 0;
int[] listi = new int[5];
double[] listd = new double[5];
Scanner input = new Scanner(System.in);
while(i < MAX_REPEAT){
System.out.println("Please input a number: ");
listi[i] = input.nextInt();
i++;
}
System.out.println("The average of these numbers is "+average(listi));
i = 0;
while(i < MAX_REPEAT){
System.out.println("Please input a number: ");
listd[i] = input.nextDouble();
i++;
}
System.out.println("The average of these numbers is "+average(listd));
}
public static double average(int[] array){
double average;
int sum = 0;
int i;
for(i = 0; i < array.length; i++){
sum += array[i];
}
average = (int)sum/array.length;
return average;
}
public static double average(double[] array){
double average;
double sum = 0;
int i;
for(i = 0; i < array.length; i++){
sum += array[i];
}
average = sum/array.length;
return average;
}
}