I'm having some trouble with this section of code:
for(int i = 0; i < MAX_NUM ;i++)
{
subList[i].readIn();
System.out.println("\nDo you want to enter another subscriber? "
+ "(Y/N): ");
anyMoreSub = keyboard.nextLine().toUpperCase();
if (anyMoreSub.equals("N"))
{
break;
}
}
while(!isDone)
{
menuChoice =
JOptionPane.showInputDialog("Please enter the letter for "
+ "your selection: " +
"\n A - Display all data" +
"\n B - Display data of specific Subscriber" +
"\n C - Display names of Subscribers with specific "
+ "friend" +
"\n D - Quit").toUpperCase().charAt(0);
while(menuChoice!='A' && menuChoice!='B' && menuChoice!='C'
&& menuChoice!='D')
{
JOptionPane.showMessageDialog(null, "Sorry, you must choose"
+ "one of the valid menu choices. Try again.");
menuChoice =
JOptionPane.showInputDialog("Please enter the number for "
+ "your selection: " +
"\n A - Display all data" +
"\n B - Display data of specific Subscriber" +
"\n C - Display names of Subscribers with specific "
+ "friend" +
"\n D - Quit").toUpperCase().charAt(0);
switch(menuChoice)
{
case 'A':
break;
case 'B':
break;
case 'C':
break;
case 'D':
isDone = true;
break;
}
}
}
When line 11 is reached, it does not enter the while loop, but instead simply sits in the terminal running forever. It's probably an obvious answer, but I'm stuck!
Thanks a lot!