Question
This is a dice game that user could roll dices and re-roll dices. Instruction: Create public class DiceGame: - public DiceGame() - a zero argument
This is a dice game that user could roll dices and re-roll dices.
Instruction:
Create public class DiceGame:
- public DiceGame() - a zero argument constructor which should initialize a new DiceHand instance and "roll" a set of five six-sided dice and store the result as an instance variable.
- public DiceGame(int[] dice) - a constructor which should set the instance variable for the dice roll to the supplied value
- public void Rerolls(int[] rerolls) - an instance method which "re-rolls" dice with the specified values. Dice are identified by value. Note: ignore incorrect inputs
- A main method implements a playable game where the user plays through 3 rounds and is allowed one opportunity to re-roll any dice after each round result is displayed.
Sample output:
2 5 6 2 3
what numbers to re-roll(separated by space): 2 3
4 5 6 2 1
2 5 6 2 3
what numbers to re-roll(separated by space): 7
2 5 6 2 3
2 5 6 2 3
what numbers to re-roll(separated by space): 2 2
5 5 6 1 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Here is a sample implementation of the DiceGame class with the specified m...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