I am working on a project that involves creating a game of Rock, Paper, Scissors against a computer opponent using the main method as a "traffic cop", directing traffic to other methods.
I am working on my user selection method and it will be an int value returning method based on String input from the user.
I figured to validate user input and bar invalid text I could use a while loop as a gate to the next part of the method (at least, I've done this in other assignments and the Prof. has not indicated this is incorrect)
My issue is my equalsIgnoreCase statement is throwing an error in Eclipse as I am trying to compare the user input string to "rock", "paper", or "scissors", as so:
I tried separating the string literals with or's ("||") as well and it eliminated the method error, but moved it to the literals, stating the first two were invalid.
Figured I'd "phone a friend" on this one because google searches seemed to only teach me about the difference between equals, equalsIgnoreCase, and compareTo; and maybe I missed it, but nothing references multiple literals.
Complete code for the method below, thanks for the assist and, as always, any critique/advice! (Pardon the no commenting, I do this last (I know, I know; bad habit))
equalsIgnoreCase takes a single String argument. When you separated the string with the || operator, you created a Boolean argument which does not match the required argument type. You need three invocations of equalsIgnoreCase, one for each string value you want to check and the appropriate Boolean operator between each invocation.