Write a Java program that plays a two player dice game called Guts.

The rules of the game are

Players take turns rolling a single 6 sided dice.

If a player rolls a 1, then the turns ends and the player receives no points for that turn.

If a player rolls a 2 – 6, they have a choice to roll again or hold,

if they hold they receive the sum of all points gained in that turn added to their game total.

If they choose roll again, then they roll again.

The first player to a set number of points is the winner.

Uses a Scanner object to ask for the users name. The users name is ***** ***** the following message: Welcome ’s name> to a game of Guts.

The game will be played against the computer.

The game will start once the user enters their name.

The first roll will occur automatically.

Each roll will display the rolled value, the total for that roll and the current game total.

After the first roll the player will be asked to enter an ‘r’ to roll again or a ‘h’ to hold. The program must accept upper or lower case values.

Use the Math.random method from the Java API Math class to randomly roll the dice.

The computers roll will follow the following algorithm

The computer will keep rolling until its turn has at least 15 points.

Once 15 points or more has been reached the computer will hold.

The computers max points per turn will be stored in a constant.

The first player to reach or exceed the specified score wins. To keep things simpler, don’t evaluate the current score against the winner score until after the turn is completed.

The specified winning score should be stored in a constant. That value should set to 50 points



    • 5 years ago
    A+ Work

    Purchase the answer to view it

    • attachment