Write a Java program to do the following using a loop:

Prompt the user to input 5 integer numbers (one at a time).

Calculate the sum, average and maximum of all the five numbers and display them.

I have the syntax for the loop down (I'm using the for loop) but I can't figure out how to format my code to be able to add the 5 inputted integer values together. Do I have to make a separate variable for each integer value? Any help would be appreciated. I have some code I've done, it is not finished whatsoever so forgive me, just using it to show you the direction I am headed in.

//This program is to calculate the sum, average, and maximum of 5 numbers. import javax.swing.JOptionPane; public class numberFacts { public static void main (String[] args) { String input; int numbers = 5; int sum = 0; int average = 0; int maximum = 0; int number1, number2, number3, number4, number5; for(int counter = 0; counter<=numbers; counter++) { input = JOptionPane.showInputDialog("Please enter an integer number."); numbers = Integer.parseInt(input); sum += counter; } JOptionPane.showMessageDialog(null, "The sum of the numbers is " + sum); System.exit(0); } }

Once I figure out how to do the sum, the average is a piece of cake... I'm just tripped up on this part.

I know it's rough. First programming class ever so cut me some slack />/>/>