Well I'm back again, this time less frazzled and well rested and I'm having some issues with my menu and sub menu.
Basically what's happening is my main menu has an exit, and it works fine when I don't get into the sub menu, but if I go into the sub menu once I exit back to the main menu it's making me choose my exit selection multiple times(it seems like it depends on how many things I do in my sub menu as to how many times I will have to select exit from the main menu before the run stops.
Here is the code for the menus, I don't think that there is anything in the rest of my code that would cause this.
I believe this is because you're using multiple scanners on System.in so your outer scanner "scanner 1" grabs your first input that sends your program to the submenu. Then the submenu "scanner 2" grabs the next input say it's "pie". When the submenu returns, you read the input from System.in again with "scanner 1". But "pie" is still queued up in "scanner 1". You should make sure that you only use one scanner object and either pass it around to each method or put it in a class where everything in your code can access it easily.
Joined: Feb 02, 2012
Hmm, yeah my knowledge of the scanner isn't much, in class it's basically like oh just use this.
And I usually put my
before everything instead of inside the methods like that, but on the last lab my instructors version had it inside the method, so this time that's how I did it.
I went back and changed it so that there aren't any scanners created inside of any of the methods it's just up at the beginning of the class and the program is working exactly the same as far as I'm noticing.