An InputMismatchException will occur while running your code when an uncooperative users enters an incorrect response. The program is expecting numeric input, 1 - 3, so typing non-numeric (non-integer) input will generate the error you've reported. Your program should account for incorrect input of this type if it's part of the assignment.
Once I make your program runnable by removing classes I don't have and adding print statements to reflect the user's choice, I get a "symbol not found" error for numEntered in the main() method. That's the error a cooperative user should be getting. I believe numEntered is a typo, but I'm going to eliminate it anyway.
Your main() method can be improved:
- isWrong is only needed as a local variable to main().
- askUser() could be named more appropriately, like "presentMenu()".
- getResponse() should return a response that is used by main().
- getResponse() should return a VALID response that is used by main().
- if getResponse() is required to return a VALID response, it should contain the while() statement and error messages that collects the user's response until it is correct.
- if getResponse() does as described above, the while() loop condition in main() will repeat until the user selects '3' for exit. A while( true ) loop would work fine for that.
- if getResponse() does as described above, the if()/else in main() branches based on the user's response.
- in main(), the askUser()/getResponse() pair should only occur once.
- the Scanner object, userInput, should not be used in main().
and, finally:
- finer point: if ( aBoolean == true ) is unnecessary. simply if ( aBoolean ) will do.
Picking and choosing from the above options, I crafted the main() method:
// a main() method to get the user's menu choice and
// branch accordingly
public static void main(String[] args)
{
drawLines();
// a loop to present the menu, get user's response, and
// branch on the user's choice until exit (or any other
// response) is chosen
while( true )
{
presentMenu();
int response = getResponse();
// this portion could be another method
// (note how this code is written so that anyone
// can run it - no external classes required.)
if (response == 1) {
System.out.println( "Game English" );
} else if (response == 2) {
System.out.println( "Game Serbian" );
} else {
System.exit(0);
}
}
} // end method main()
Good luck! Keep coding.