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 player's 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., player1's choice and player2's 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.
Comparing with using functions, what is the difference if you write all of the code directly in the main function? Describe what you think in the comment header (1 point).
Your program output should look something like the following:
(see attach file)
This question was answered on: Apr 19, 2020Buy this answer for only: $15
This attachment is locked
Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
About this QuestionSTATUS
Apr 19, 2020EXPERT
YES, THIS IS LEGAL
We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.
You can also use these solutions:
- As a reference for in-depth understanding of the subject.
- As a source of ideas / reasoning for your own research (if properly referenced)
- For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
NEW ASSIGNMENT HELP?
Order New Solution. Quick Turnaround
Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.
WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE.