I need to figure out a way to print an overall statistic info list at the bottom, such as
Should I assign number values to ties, wins, and losses, and then return a value back to main and have a sum function?
Any help is appreciated, thanks!
Could you please explain the program bit more. You run the game for the number of times specified by the user. Say if user gives 10, the for loop in the games() method might run 10 times. But you are having a return statement at each of your conditional clauses. So I think how much time of games user inputs, the run is always going to give one win or one lose or one tie.
Since you have all methods as static - you could have the wins, loses, ties as static counters and print the value in the stat() method.
You would do better to create an enum for RPS and also one for win-lose-tie. You can use the == operator on enum members, and you can put enum members after case in a switch block.
The == sign works on enum members exactly the way it doesn’t work on Strings. You seem to know that because you used equals() elsewhere.
Your long if () lines are suspicious; I had to put new lines in them, otherwise they are difficult to see. If you get lines that long you have to be very careful that you have got all the && and || in the right places.
I disagree. "==" is perfect for all value types which guarantee to have exactly one instance per value. These do not only include primitives, but also enums and custom types which are instance controlled. Such code is less verbose than using the equals() method.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
And they shouldn't. But they can use them for instance controlled types that guarantee to only have one instance per value. In this case, the equals method need not be overridden, and becomes identical to the == operator.
This does not include the String and Integer classes for example. They don't make this guarantee. Enums on the other hand, do.