Final answer:
To determine the number of coins that player 2 will spend in a given round of the game, check the rules based on the value of the round: divisible by 3 = 3 coins, divisible by 2 but not by 3 = 2 coins, not divisible by 3 and not divisible by 2 = 1 coin.
Step-by-step explanation:
To determine the number of coins that player 2 will spend in a given round of the game, we need to check the rules based on the value of the round:
If the round is divisible by 3, player 2 will spend 3 coins.
If the round is not divisible by 3 but is divisible by 2, player 2 will spend 2 coins.
If the round is not divisible by 3 and not divisible by 2, player 2 will spend 1 coin.
So, the method getPlayer2Move should be defined as follows:
public
int getPlayer2Move(int round)
{
if (
round % 3 == 0) { return 3;
}
else if
(
round % 2 == 0
) {
return 2;
} else {
return 1;
} }