Question: Implement a Java program that is based on the simulated roll of 3 dice. Player scores points based on the combination of (1) the sum

Implement a Java program that is based on the simulated roll of 3 dice.

  • Player scores points based on the combination of (1) the sum of the dice and (2) bonus points from rolling a pair, a triple, or a straight (3 numbers in a row).
  • Player rolls 3 dice in the first roll, and then decides for each die whether to roll again or lock the value of a die in order to improve the score hence, the name Lock N Roll.
  • At the beginning of the game, player will enter his/her name and the number of turns they wish to have in a single game. A turn is an initial roll plus the second roll after lock/reroll.
  • After all turns have been played, the program will print a history of the turns showing the players initial roll score, final roll score, and the improvement after the Lock N Roll action.
  • Player is prompted to play again or not.

EXPECTED OUTPUT:

Welcome to the Java Dice Game, Lock N Roll!

The object of the game is to roll 3 dice and earn the most points.

Player earns points by maximizing the sum of the dice and earning bonus points.

Bonus points are earned when rolling a pair, triples, or a straight:

o Pair Bonus: 2 points

o Triple Bonus: 30 points

o Straight Bonus: 10 points

Player gets 2 rolls. After the first roll, player chooses to either

"Lock" or "Roll" a die again, for each of the 3 dice.

Scoring for the turn is complete after the second roll.

Enter your name to begin this fast-action game, and let's LOCK N ROLL!

Name: User

How many turns would you like in this game? 2

************** Begin Turn 1***************

1 2 3 Sum Pair Trip Strait Points

-- -- -- --- ---- ---- --- ---

Roll-1 2 4 4 10 2 0 0 12

Now it's time to LOCK N ROLL!

Die1 value: 2 Enter L or R: r

Die2 value: 4 Enter L or R: l

Die3 value: 4 Enter L or R: l

1 2 3 Sum Pair Trip Strait Total

-- -- -- --- ---- ---- ---- ----

Roll-2 4 4 4 12 0 30 0 42

--Roll1-- --Roll2-- Sum Pair Trip Strait Total Imprv

-- -- -- -- -- -- --- ---- ---- ---- ---- ----

Turn-1 2 4 4 4 4 4 12 0 30 0 42 30

**************************************************************

************** Begin Turn 2***************

1 2 3 Sum Pair Trip Strait Points

-- -- -- --- ---- ---- --- ---

Roll-1 2 4 6 12 0 0 0 12

Now it's time to LOCK N ROLL!

Die1 value: 2 Enter L or R: r

Die2 value: 4 Enter L or R: l

Die3 value: 6 Enter L or R: l

1 2 3 Sum Pair Trip Strait Total

-- -- -- --- ---- ---- ---- ----

Roll-2 1 4 6 11 0 0 0 11

--Roll1-- --Roll2-- Sum Pair Trip Strait Total Imprv

-- -- -- -- -- -- --- ---- ---- ---- ---- ----

Turn-2 2 4 6 1 4 6 11 0 0 0 11 -1

**************************************************************

Turn History for this session

User Turn-1 2 4 4 4 4 4 Pts: 42 Imprv: 30

User Turn-2 2 4 6 1 4 6 Pts: 11 Imprv: -1

Would you like to play again? Enter Y or N: N

Thanks for playing, User! Come back and play again soon!

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!