Question: Another dice game! This game is similar to the Doubles gameshown in class but is called ?HighLow?. This game has two players, you and the


Another dice game! This game is similar to the Doubles gameshown in class but is called ?HighLow?.

This game has two players, you and the computer. Each player hastwo dice and starts with $100. The game begins with a bet from eachuser up to the amount they currently have. The players then rolltheir dice and the player with the higher dice total wins theirbet. The loser loses their bet amount. The game continues as longas you want or until one of the players lose all their money.

To begin creating this game, you are going to create a ?Player?class that encapsulates the amount of money they have and two Dieobjects (use the Die class from the Doubles game). The class willalso have a default constructor that sets the amount of money theyhave to 100 and two functions. The first function, ?roll?, will beused to randomize their dice. The second function, ?total?, will beused to return the total amount of their dice values.

Create a simple program to test your new class and itsfunctions.

package Doubles; import java.util.Random; public class Die { } private int value;

package Doubles; import java.util.Random; public class Die { } private int value; public Die() { Roll(); } public void Roll() { } Random random = new Random(); setValue(random.nextInt( bound: 6) + 1); public int getValue() { return value; } public void setValue(int value) { this.value = value; }

Step by Step Solution

3.25 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is an example of the Player class that you can use to create the HighLow game class Player priv... View full answer

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 Programming Questions!