In the Dice Roll game, the player begins with a score of 1000. The player is prompted for the number of points to risk and a second prompt asks the player to choose either high or low. The player rolls two dice and the outcome is compared to the player's choice of high or low. If the dice total is between 2 and 6 inclusive, then it is considered "low". A total between 8 and 12 inclusive is “high". A total of 7 is neither high nor low, and the player loses the points at risk. If the player had called correctly, the points at risk are doubled and added to the total points. For a wrong call, the player loses the points at risk. Create a DiceRollGame application that uses a DRPlayer object based on this specification. The DRPlayer object should have two Die member variables that represent the dice. The Die class should use a random number generator to determine the outcome in a roll() method. Application output should look similar to:

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter6: Looping
Section: Chapter Questions
Problem 5GZ
icon
Related questions
icon
Concept explainers
Question

This is for java, I need the code in java format for programs like eclipes 

Exercise 4
DiceRollGame
In the Dice Roll game, the player begins with a score of 1000. The player is prompted for the number
of points to risk and a second prompt asks the player to choose either high or low. The player rolls
two dice and the outcome is compared to the player's choice of high or low. If the dice total is between
2 and 6 inclusive, then it is considered "low". A total between 8 and 12 inclusive is "high". A total of
7 is neither high nor low, and the player loses the points at risk. If the player had called correctly, the
points at risk are doubled and added to the total points. For a wrong call, the player loses the points at
risk. Create a DiceRollGame application that uses a DRPlayer object based on this specification. The
DRPlayer object should have two Die member variables that represent the dice. The Die class should
use a random number generator to determine the outcome in a roll() method. Application output
should look similar to:
You have 1000 points.
How many points do you want to risk? (-1 to quit) 10
Make a call (0 for low, 1 for high): 1
You rolled: 10
You now have 1020 points.
How many points do you want to risk? (-1 to quit) 20
Make a call (0 for low, 1 for high): 1
You rolled: 11
You now have 1060 points.
How many points do you want to risk? (-1 to quit) 20
Make a cal1 (0 for low, 1 for high): 1
You rolled: 7
You now have 1040 points.
How many points do you want to risk? (-1 to quit) -1
Transcribed Image Text:Exercise 4 DiceRollGame In the Dice Roll game, the player begins with a score of 1000. The player is prompted for the number of points to risk and a second prompt asks the player to choose either high or low. The player rolls two dice and the outcome is compared to the player's choice of high or low. If the dice total is between 2 and 6 inclusive, then it is considered "low". A total between 8 and 12 inclusive is "high". A total of 7 is neither high nor low, and the player loses the points at risk. If the player had called correctly, the points at risk are doubled and added to the total points. For a wrong call, the player loses the points at risk. Create a DiceRollGame application that uses a DRPlayer object based on this specification. The DRPlayer object should have two Die member variables that represent the dice. The Die class should use a random number generator to determine the outcome in a roll() method. Application output should look similar to: You have 1000 points. How many points do you want to risk? (-1 to quit) 10 Make a call (0 for low, 1 for high): 1 You rolled: 10 You now have 1020 points. How many points do you want to risk? (-1 to quit) 20 Make a call (0 for low, 1 for high): 1 You rolled: 11 You now have 1060 points. How many points do you want to risk? (-1 to quit) 20 Make a cal1 (0 for low, 1 for high): 1 You rolled: 7 You now have 1040 points. How many points do you want to risk? (-1 to quit) -1
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr