Here is how I would do it. Get rid of all those variables. Read user input as a String. Iterate over the String one char at a time and use a switch statement.