Question
5) (25 points) Rock, Paper, Scissors Game Write a program that lets the user play the Rock, Paper, Scissors game against the computer. The program
5) (25 points) Rock, Paper, Scissors Game Write a program that lets the user play the Rock, Paper, Scissors game against the computer. The program should work as follows: a. At the start, the program generates a random number in the range of 1 through 3 If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don't display the computer's choice yet.) b. The user enters the choice of "rock, "paper," or "scissors," at the keyboard c. The program displays the computer's choice (rock, paper, or scissors) d. The program selects a winner according to the following rules: If one player chooses rock and the other player chooses scissors, then rock wins If one player chooses scissors and the other player chooses paper, then scissors wins If one player chooses paper and the other player chooses rock, then paper wins If both players make the same choice, the program plays again to determine the winner. e. The program offers the user a chance to play again (Enter "c" to play again. any other letter to exit) Example run: Enter 1 for rock, 2 for paper, 3 for scissors: 2 Computer chose paper You chose paper You made the same choice as the computer. Starting over Enter 1 for rock, 2 for paper, 3 for scissors: 1 Computer chose scissors You chose rock You win the game Enter "c" to play again. any other letter to exit:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started