posted 14 years ago
Ok this one might be too hard to solve via forum, but I will throw it up here anyway.
I am writing an inventory management program and I am using if statements to decide what to do as the user enters a number in the command line.
The problem is... when it asks for a number and a number is entered it then asks for the number again, for what seems like a random number of times, and then it finally registers the number and does the right thing. To clear things up, I need it to ask for the number only once, and do the right thing the FIRST time it is entered.
This is the options class that determines which number is entered. and always reprints the menu, and asks for more input.
This is the menu class which has two methods, one to create the menu and another to grab the input, the second method could be the issue.
Lastly this is the class I use to run the whole thing, it first creates the menu and then decides on the input.
This has been a night long project and it is going well, minus this issue of reprinting the selection line over and over until it randomly is happy. Sorry for all of the code, but I think this is a good example for those who have a similar assignment. There are a couple of other classes like create inventory, but they do not have any impact on this issue.
Thanks for the help, this forum has been awesome.