Hi, I was just wondering why my program wouldn't output the elements that I entered. Thanks in advance.
//Scanner utility
import java.util.Scanner;
public class A4 {
public static void main(String[] args) {
//Reads user input.
Scanner inputReader = new Scanner(System.in);
//Declares an array,size of the array is 10.
int[] elements=new int [10];
//Variable for option number
int option;
//Looping menu system.
while (true)
{
System.out.println("1.Fill array");
System.out.println("2.Sort array");
System.out.println("3.Delete element at a given index in the array");
System.out.println("4.Delete all elements in the array with a given value");
System.out.println("5.Search array for a given value");
System.out.println("6.Reverse array");
System.out.println("7.Output array");
System.out.println("8.Exit");
//Next input will be option picker
option = inputReader.nextInt();
//Performs different operations depending on user input.
switch (option){
case 1:
System.out.println ("Enter 10 numbers:");
for(int index=0;index<10;index++)
{
elements[index]= inputReader.nextInt();
}
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
System.out.println ("The elements that you entered were:" + elements [index]);
break;
case 8:
System.out.println ("Good bye!");
System.exit (0);
break;
}
}
}
}