Question: Write a program IN JAVA that simulates a game of dice. In this game, 3 players will take alternate turns rolling two dices until at

Write a program IN JAVA that simulates a game of dice. In this game, 3 players will take alternate
turns rolling two dices until at least one player reaches a total of 15 or more. 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. To make the game fair, all three players are allowed to roll in the last
round, in which one of them hits 15 or more.
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. After all players finish the rolling, the
code then checks the sum of each player and determine the first, 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 thats >=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 thats
>=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).
NO USER INPUT
For this question, loop(s) and conditionals should be used otherwise you will lose
marks. Don't hardcode the output otherwise marks will be deducted.
The output should be as follow (note: no user input is required):
Player 1 rolls a 1 and a 1
Player 1 now has 2
Player 1 rolls a 6 and a 1
Player 1 now has 9
Player 2 rolls a 3 and a 2
Player 2 now has 5
Player 3 rolls a 5 and a 1
Player 3 now has 6
Player 1 rolls a 4 and a 3
Player 1 now has 16
Player 2 rolls a 6 and a 1
Player 2 now has 12
Player 3 rolls a 6 and a 5
Player 3 now has 17
Player 3 wins the first place with a total of 17
Player 1 wins the second place with a total of 16
Player 2 wins the third place with a total of 12
 Write a program IN JAVA that simulates a game of dice.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!