Question: Write a program that plays rock, paper, scissors. This is an interactive game between two players. The sample run provided below represents the user
Write a program that plays rock, paper, scissors. This is an interactive game between two players. The sample run provided below represents the user interaction and the output displayed. Important Notes: 1. Your code will use decision-making, nested structures. 2. Both upper- and lower-case letters should be considered. 3. Four cases for player 1: R, P, S and never forget the default case. Within each of the first three cases, there are four cases for player two. 4. Incorporate an iteration method that allows the user to play again, as many times as they like. 5. Your code must demonstrate at least 1 method from the String class Sample output: Test case 1: [NOT A TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: r Player 2, Enter your choice: p Rock v. Paper Player 2 wins again? y Player 1, Enter your choice: P Player 2. Enter your choice: S Let's play Rock, Paper, Scissors. Player 1, Enter your choice: r Player 2, Enter your choice: p Rock v. Paper Player 2 wins. again? y Player 1, Enter your choice: P Player 2, Enter your choice: S Paper v. Scissors. Player 2 wins. again? Y Player 1, Enter your choice: R Player 2, Enter your choice: si Rock v. Scissors. Player 1 wins again? N Nice game! Test case 2: [TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: R Player 2, Enter your choice: R Rock v. Rock It's a TIE again? y Test case 2: [TIE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: R Player 2, Enter your choice: R Rock v. Rock It's a TIE again? y Player 1, Enter your choice: pi Player 2, Enter your choice: p Paper v. Paper It's a TIE again? n Nice game! Test case 3: [INVALID CHOICE] Let's play Rock, Paper, Scissors. Player 1, Enter your choice: p Player 2, Enter your choice: w Paper v. IERROR: w not a valid mave. ] again? y Player 1, Enter your choice: m [ERROR: m not a valid move.] again? ni Nice game!
Step by Step Solution
3.49 Rating (146 Votes )
There are 3 Steps involved in it
Step 13 Certainly Heres a C program that implements the Rock Paper Scissors game according to your requirements including the use of switch statements and nested structures for decision making include ... View full answer
Get step-by-step solutions from verified subject matter experts
