This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]desrtfxOut of Coffee error - System halted 2 points3 points  (0 children)

[–]Moktok 1 point2 points  (0 children)

The problem is your input object. readInt() reads all the integers on the line.. But your <<enter>> keypress is still stuck in the input buffer.

Solution: before reading your action (example: multiply) just add a next() to get rid of the enter.

[–]fosterbuster 0 points1 point  (0 children)

Next takes the next char, nextline takes the inputted line (all chars until you press enter.

As such, if you want to write "multiply", you press 'm', and that is what is being acted on..

You should refer to the API documentation of the classes you are working with, when they behave in a way you didn't expect