Solved. Thanks
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Solved. Thanks
Last edited by parkBENch; March 18th, 2012 at 05:24 PM.
Where is the main() method?
Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.
- Henry Ford
Sorry, here it is.
Last edited by parkBENch; March 18th, 2012 at 05:24 PM.
And where is getUserSelection()?
Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.
- Henry Ford
parkBENch (March 16th, 2012)
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;getUserSelection();
selection = getUserSelection();
Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.
- Henry Ford
zipstacrack (March 16th, 2012)
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.
See you in compsci101 - even though I don't know who you are.
Last edited by zipstacrack; March 16th, 2012 at 09:18 PM.
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.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.
Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.
- Henry Ford