my problem is the once i input any character into the program it goes into a infinite loop, i can only guess its something to do with the scanner method i am using but i dont know.
here the code.
any help is appreciated
Thanks Dale
here the code.
public static int mainMenu()
{
Scanner in = new Scanner(System.in);
int input;
boolean inputMisMatch;
do
{
// set input mismatch to jump out of the loop
inputMisMatch = false;
input = 0;
System.out.println();
System.out.println("*************************************************");
System.out.println("*** Main menu");
System.out.println("*** ");
System.out.println("*** 1. Proccess New Job (using decimal values)");
System.out.println("*** 2. Proccess new job (using RGB hexadecimal values)");
System.out.println("*** 3. Calibrate Dispenser");
System.out.println("*** 4. Dipsplay Summary of Jobs");
System.out.println("*** 0. Exit");
try
{
System.out.print("***\n*** Please choose a option: ");
input = in.nextInt();
}
catch (Exception e)
{
System.out.println("\nPlease only type in intergers to provent form crashing");
// set inputMisMatch to itirate though the loop again.
inputMisMatch = true;
}
System.out.println();
} while (inputMisMatch );
//(input > 4)
return input;
}
any help is appreciated
Thanks Dale