Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA create a main() method In a method do the following: Roll 2 six sided dice 36 times, and store the results in a Hashtable
JAVA
create a main() method
In a method do the following:
Roll 2 six sided dice 36 times, and store the results in a Hashtable
After the dice are rolled, report the results in a histogram
for each line print the result, and the number of times the result was rolled
For example, if a "4" was rolled 6 times, the line would look like this:
4: ******
You can do this in the main() method.
You can use the ThreadLocalRandom class to get random numbers. Try using ThreadLocalRandom.current().nextInt(1, 7);
you will create a DiceRoller class that is a Singleton. The DiceRoller class will include the following methods:
public int rollDice( int numberOfSides, int number OfDice );
You will need to include the constructor, and make it private
You will need to include a getInstance() method
create a main() method
In a method do the following:
Roll 2 six sided dice 36 times, and store the results in a Hashtable
After the dice are rolled, report the results in a histogram
for each line print the result, and the number of times the result was rolled
For example, if a "4" was rolled 6 times, the line would look like this:
4: ******
You can do this in the main() method.
You can use the ThreadLocalRandom class to get random numbers. Try using ThreadLocalRandom.current().nextInt(1, 7);
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