Question: Java programming ! The player starts with $100. The player throws 2 dice, which 6 sides on each. If the sum of both dice equals

 Java programming ! The player starts with $100. The player throws Java programming !

The player starts with $100. The player throws 2 dice, which 6 sides on each. If the sum of both dice equals 2, 7, or 11, the player wins. Otherwise the player loses. If the player wins, the sum of the two dice is added to his balance. If he loses, it is subtracted from it. If the player reaches a balance of 0 or below, the game ends. After each throw, the program should ask the user if he wants to play again. If he enters 'Y' for Yes, the dice are thrown again. If the user enters N' for no, the program exits. Create a class called Dice. This class has an integer parameter called value. This class also has a function called throwDice. This function simulates the throwing of the dice, and assigns a random value from 1 to 6 to the objects value parameter. The class also has a function called get Value. This function returns the current value of the dice. After every throw, let the user also know his current balance, the outcome of the two dice throws, and whether he won or lost the throw

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!