Question: Write a program to score the paper-rock-scissors game AGAIN. Each of two players enters either P, R, or S. The program then announces the winner

Write a program to score the paper-rock-scissors game AGAIN. Each of two players enters either P, R, or S. The program then announces the winner as well as the basis for determining the winner: Paper covers rock, Rock breaks scissors, Scissors cut paper, or Draw, nobody wins. The primary differences between this and previous two versions are described as below: (1) You MUST use a function to get the input value for the players choice. The players must be able to enter either upper- or lower-case letters. If an invalid choice is entered, the player should be permitted to re-enter his choice immediately (before the other player is given a chance to enter their value). The function returns an enumerated type (e.g., Choice) that has possible three values, ROCK, PAPER, and SCISSORS (the one you defined in the previous version). This makes it so that the only part of your program that pertains to the player choices that can involve character variables is the input portion. The rest of your program should always use variables of the enumerated Choice type. (2) you MUST use a function, e.g., checkWinner, to compare two choices, decide the winner, and print the result on the screen. This means that the function takes two Choice type arguments (i.e., player1s choice and player2s choice) and returns nothing. Use breakpoints to watch the formal parameter values when the function is called if needed. (3) this program must allow the players to continue playing as long as desired by asking them after each game if they would like to play again.

Should look like:

Write a program to score the paper-rock-scissors game AGAIN. Each of two

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!