Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago

Question

1. Understand how verbal and nonverbal communication differ.

Answered: 1 week ago