I definitely need assistance with homework assignment: I seem to have a lot of issues creating a program when I have to use JOptionPanes(s). After the instructions is my current code.
1. Design and implement a Java program that will gather integer numbers and performs some computations on the data entered. The program should use separate methods for inputting the data, calculating the sum, calculating the average, calculating the number closest to the average, and displaying the results. A sentinel value should be used to indicate the user has completed entering their numbers. The output should display a message that includes the count of the numbers entered, the sum of the numbers, the average of the numbers, and the number closest to the average.
2. Additional requirements include:
a. Use JOptionPane.showInputDialog() methods for your user to input their data
b. Use JOptionPane.showMessageDialog() methods to display your messages.
public class Project2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
for (int counter = 1; counter <= 10; counter++) {
JOptionPane.showInputDialog(null, "Please enter ten numbers",
"Question to User.",
JOptionPane.QUESTION_MESSAGE);}
int number = input.nextInt();{
int array[] = new int [number];
String output = " ";
for (int number, numbers) {
output += " " + number;
}
JOptionPane.showMessageDialog(null, "Here are the numbers you selected." + output);
}
}
}