Question: Write a Java program that plays rock-paper-scissors (RPS). Use chars or strings, not integers, for encoding the possible plays (R, P or S). Prompt the
Write a Java program that plays rock-paper-scissors (RPS). Use chars or strings, not integers, for encoding the possible plays (R, P or S). Prompt the user for her/his choice of play first, before the computer generated randomly its selection of P, R or S.
Use a while loop to keep prompting the user to play again against the computer, until one of the players have won 3 games (so, for those of you who are sport fans, this is the best-of-5 format; in particular, the three wins need not be consecutive). Tied games should be ignored insofar as keeping the tally of each players wins and deciding when to terminate the multi-game playoff series. Your output should include the sequence of plays (choices by the computer and user, outcome of each game/who won), obviously terminating with either the computer or the user having won their third game -- whoever wins 3 games first.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
