Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Java. I got driver. So I just need these methods. 1. rps This method simulates the playing of one round of CMSC 131 Rock
In Java. I got driver. So I just need these methods.
1. 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. 2. playRps This method plays 24 rounds of rps and returns the total points earned. For each of the 24 rounds, playerl's hand gesture will be based on calling the nextInt method of the given Random object. If the next integer is even, playerl will play rock. If it is odd, playerl will play paper. Playerl 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. 3. triangleWord This method will return a string that when printed out will display a triangle. Each row of the triangle will have the next letter from the input argument as the last letter in the row If the next letter is the noPrint char, * will print out instead of letters for that row. See the output of the SampleDriver for details. 4. squareWord - This method will return a string that when printed out will display a square or Bad input. If the input argument has at least one noPrint char in it, the string Bad input is returned. Otherwise return a square, where each row reveals just the next letter of input and the remaining letters are *. See the output of the Sample Driver for details. =rps Output -1 0 =playRps Output== 6 =triangleword Output cl *** clev ***** clevel clevela clevelan cleveland =squareWord Output== Bad input C*********** cl***** cle**** clev***** cleve**** clevel*** clevela** clevelan* clevelandStep 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