Question
In each round of the game, the player and the computer each spin a spinner. The player spins a spinner numbered 1 to 10 ,
In each round of the game, the player and the computer each spin a spinner. The player spins a spinner numbered 1 to 10 , inclusive, whereas the computer spins a spinner numbered 2 to 8, inclusive. Based on the results of the spins, a message is printed in the formats shown in the examples below. If the player obtains a higher result than the computer, the player gains a number of points equal to the positive difference between the spins. If the computer obtains a higher result than the player, the player loses a number of points equal to the positive difference between the spins. In the event of a tie, the player and the computer each spin the spinner a second time. If the sum of the players two spins are greater than the sum of the computers two spins, the player gains one point. If the sum of the computers two spins are greater than the sum of the players two spins, the player loses one point. In the event of a tie after two spins, the round is reported as a tie and the players score does not change. Examples of the playRound methods intended behavior are shown in the following table.
(b) Complete the playRound method below. You must use the spin method appropriately in order to earn full credit.
In each round of the game, the player and the computer each spin a spinner. The player spins a spinner numbered 1 to 10, inclusive, whereas the computer spins a spinner numbered 2 to 8, inclusive. Based on the results of the spins, a message is printed in the formats shown in the examples below. If the player obtains a higher result than the computer, the player gains a number of points equal to the positive difference between the spins. If the computer obtains a higher result than the player, the player loses a number of points equal to the positive difference between the spins. In the event of a tie, the player and the computer each spin the spinner a second time. If the sum of the player's two spins are greater than the sum of the computer's two spins, the player gains one point. If the sum of the computer's two spins are greater than the sum of the player's two spins, the player loses one point. In the event of a tie after two spins, the round is reported as a tie and the player's score does not change. Examples of the playRound method's intended behavior are shown in the following table. Player Spin Player Spin #1 Computer Spin #1 Computer Spin #2 Printed String #2 9 6 3 7 You win! 3 points You lose. -4 points You win! 1 points You lose. -1 points Tie. 0 points 4 4 6 2 N 6 01 6 1 2. 1 1 00 8 8 (b) Complete the playRound method below. You must use the spin method appropriately in order to earn full credit /** Simulates one round of the game as described in part (b). */ public void playRound() Please respond on separate paper, following directions from your teacherStep 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