Question
Create a dice game in java... The game: A new player begins with his first dice roll (4 die = 1 set of dice). This
Create a dice game in java...
The game: A new player begins with his first dice roll (4 die = 1 set of dice). This is known as the "starting roll."
If the player rolls a 6, 12, 18, or 24 the player wins.
If the player rolls a 9, 11, 17, 19, or 23 the player loses.
If the player rolls any other number, the "starting roll" becomes the "goal number."The player must continue to roll the dice until either one of two things happens:
The player rolls an 11, and he loses.The player rolls the "goal number" again, and he wins.
The Task:
Create a Die (single dice) class. This class will be instantiated as a Die object in the main() method of the program four times to represent four dice, which plays the game. In the class definition, create attributes and methods that you think you need in order to create the program. Solve the problem as you wish. Build at least a roll() method.
Using this Die class that you define, instantiate it four times by creating four Die objects in your main() method for game execution.
Provide a functionality that allows the computer to play on its own without user prompting. The user inputs a number that is the number of times the computer should play the game on its own, and when s/he pushes the button, the computer plays the game that many times. After playing, the computer should output the final results of all of the games. You can also output the win or loss after each game - your choice. After being displayed a welcome message, display instructions to the end user as to enter a "1" or a "2." The user can enter "1" to play the game manually, or enter "2" to have the computer play on its own. If the user inputs "1" the manual, single should execute. If the user inputs "2" the user inputs a number that is the number of times the computer should play the game on its own, and then the computers plays the game that many times - outputting the results of each game and a tally at the end of the number of total wins and the number of total losses. The game should, in either mode, allow the end user to play again.
You can add any additional static methods you like to better organize your source code, but I only require the welcome(String name) method to be defined, and for it to be called for execution in the main() method. IN JAVA
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started