Write a java program that simulates a game of dice. In this game, 3 players will take alternate turns rolling two dice. On each turn, they record the sum of the two dice and add this to their total. If a player rolls a doublet (both dice have the same value), then the player gets to roll again until the doublet disappears. After each turn (when both roll), the code checks the sum of each player and the first player to reach a total of 15 or more will win the first place. When a player surpasses 15 but with a doublet (both dice have the same value), the player still gets to roll again until the doublet disappears. The code then checks for the second and third place winners. The code will print out to the user the winners in order. If 2 or all the players hit the same sum, you can consider them all first place winners (for example, if player 1 and 2 hit the same sum that’s >= 15 and 3rd player hits a sum less than 15, then you can say 1st and 2nd players win first place and 3rd wins second place). The same rule applies to a tie for the 2nd place (for example, if player 1 hits the sum that’s >= 15 and player 2 and 3 hit the same sum less than 15, then you can say 1st player wins the first place and 2nd and 3rd players win the second place). For this question, loop(s) and conditionals
Write a java program that simulates a game of dice. In this game, 3 players will take alternate
turns rolling two dice. On each turn, they record the sum of the two dice and add this to
their total. If a player rolls a doublet (both dice have the same value), then the player gets
to roll again until the doublet disappears.
After each turn (when both roll), the code checks the sum of each player and the first
player to reach a total of 15 or more will win the first place. When a player surpasses 15
but with a doublet (both dice have the same value), the player still gets to roll again until
the doublet disappears. The code then checks for the second and third place winners. The
code will print out to the user the winners in order.
If 2 or all the players hit the same sum, you can consider them all first place winners (for
example, if player 1 and 2 hit the same sum that’s >= 15 and 3rd player hits a sum less
than 15, then you can say 1st and 2nd players win first place and 3rd wins second place).
The same rule applies to a tie for the 2nd place (for example, if player 1 hits the sum that’s
>= 15 and player 2 and 3 hit the same sum less than 15, then you can say 1st player wins
the first place and 2nd and 3rd players win the second place).
For this question, loop(s) and conditionals
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images