I'm pretty new to arrays and am trying to create a simple program that calculates the average of 5 numbers. However, when the average is calculated, it always has a decimal point of 0 rather than what it should be, but I'm not sure why.. For example, if I type in 4, 4, 4, 4, 3, it displays 3.0 as the average rather than 3.8. Please help!
int[] boxes = new int[5];
for (int i = 1 ; i <= 5 ; i++)
{
System.out.print("Enter number " + i + " > ");
int n = Integer.parseInt(kb.nextLine());
boxes[i-1] = n;
}
double mean = ( boxes[0] + boxes[1] + boxes[2] + boxes[3] + boxes[4] ) / 5;
System.out.println("The average of those five numbers is: " + mean);
Thank you!! :)