java rolling dice program
Subject
Programming
Question Description
Histogram.java
HistogramCLI.java
In this project, we will write a program that simulates the rolling of dice, performs many rolls, and determines the frequency for each possible sum of the dice. We will create a kind of bar graph called a histogram and display it in two forms - one horizontal and one vertical. This project will require you to write several loops that process the integer variables in an array - as well as how to use a method (even if you do not understand it's inner workings).
You can find an initial version of the Histogram.java and HistogramCLI.java source files in project2.zip. As always, download and unzip this file on your removable media (or your own computer). You may find it helpful to create/save a Dr Java project file in the project2 directory.
How this program will work is as follows:
Prompts user for how many dice to roll (1 to 3).
Prompts user for how many sides each die should have (2 to 9).
Asks user how many times to roll the dice (1000 to 2 billion).
Rolls the dice that number of times.
Creates a Histogram object and determine how tall each bar should be.
Calls the Histogram object's methods for drawing the histogram, both horizontal and vertical. (Check out the sample outputbelow, to see how this might look.)
For this project, you will be working in both classes, writing the code that enables the program to work. The individual steps are in the comments in the files, but I'll also go over them briefly here: