Question: 3. Write a Java program that plays the kids' game rock-paper- scissors (RPS). Assume scissors win vs. paper, paper wins vs. rock and rock wins

 3. Write a Java program that plays the kids' game rock-paper-

3. Write a Java program that plays the kids' game rock-paper- scissors (RPS). Assume scissors win vs. paper, paper wins vs. rock and rock wins vs. scissors. The program randomly generates an int among the values {0, 1, 2} representing rock, paper, and scissors, respectively. The program prompts the user to enter a value 0, 1 or 2 and then displays a message on who has won, based on the RPS game rules above. Should both the user and the program pick the same choice, the game is tied (i.e., nobody won). Show the output of your game for five different choices of play (computer, user) where each of computer and user is one of 0, 1 or 2. (For example, (0, 1) means computer played rock and user played paper, so the user would win in that scenario.) NOTE: since we will have covered the char datatype in the meantime, feel free to use e.g. char R, P, S instead of int 0, 1, 2 if you'd like (optional)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!