Solved. Thanks ;)
Printable View
Solved. Thanks ;)
Where is the main() method?
Sorry, here it is.
And where is getUserSelection()?
Code :private int getUserSelection() { System.out.print(" Enter selection: "); String userSelection = Keyboard.readInput(); return Integer.parseInt(userSelection); }
So, this function returns an integer. In your above code where you store the returning value?
In your code you are actually doing this;
which means you discard the returned value. selection variable still has -1 in it's value. Use this;Code :getUserSelection();
Code :selection = getUserSelection();
First off, don't feel bad about it not executing properly, that was the universities fault - a logic error on their part.
The assessment worked wrong like that.
Mr.777 provided what the code SHOULD have looked like.
Well, good work on starting the assessment already. If this wasn't an error on their part this would be breaching the rules searching for help else where but oh well. :P
See you in compsci101 - even though I don't know who you are.
parkBENch didn't ask for the code by the way. I don't know if it's university's task or OP\'s personal. OP asked for the help, we are here to help and also we don't do homework for others.Quote:
Well, good work on starting the assessment already. If this wasn't an error on their part this would be breaching the rules searching for help else where but oh well.