Question: plz use java and only solve playRps dont use array rps This method simulates the playing of one round of CMSC 131 Rock Paper Scissors.
plz use java and only solve playRps dont use array
rps This method simulates the playing of one round of CMSC 131 Rock Paper Scissors. In this strange version of the game, if both players have the same hand gestures, the return value is 1. If they have different hand gestures, the return value is a 0. If at least one player, provides a string argument that is anything other than rock, paper, or scissors, the return value is -1. The method should not be case-sensitive. For example, rock, ROCK, Rock, and RocK are all valid.
playRps This method plays 24 rounds of rps and returns the total points earned. For each of the 24 rounds, player1s hand gesture will be based on calling the nextInt method of the given Random object. If the next integer is even, player1 will play rock. If it is odd, player1 will play paper. Player1 never plays scissors. Player2 will play rock in the first round, paper in the second round, scissors in the third round, and repeat the cycle starting with rock again in the fourth round. The method will sum the return values for the 24 calls to rps and return the total. Note, since an invalid input is never passed in to an rps call using playRps, your return value should always be a non-negative number.
Erps Output: -1 1 - =playRps Output= 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
