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, players will take alternate
turns rolling two dices until at least one player reaches a total of 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 or more.
When a player surpasses 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 or all the players hit the same sum, you can consider them all first place winners for
example, if player and hit the same sum thats and rd player hits a sum less
than then you can say st and nd players win first place and rd wins second place
The same rule applies to a tie for the nd place for example, if player hits the sum thats
and player and hit the same sum less than then you can say st player wins
the first place and nd and rd players win the second place
NO USER INPUT
For this question, loops 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 rolls a and a
Player now has
Player rolls a and a
Player now has
Player rolls a and a
Player now has
Player rolls a and a
Player now has
Player rolls a and a
Player now has
Player rolls a and a
Player now has
Player rolls a and a
Player now has
Player wins the first place with a total of
Player wins the second place with a total of
Player wins the third place with a total of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
