Question: write a Java console application that repeatedly rolls a seven-sided die and tabulates the roll counts. Use a validation loop to prompt for and get

write a Java console application that repeatedly rolls a seven-sided die and tabulates the roll counts. Use a validation loop to prompt for and get from the user the number of rolls to simulate in the range 10-1,000,000. Store the counts for the simulation in an array. Declare the array as a private static field so that it doesnt need to be passed around. After each simulation, print the counts. Format the output in three columns with the first column containing a number (1-7), the second column containing its count, and the third column containing the percentage of that count over the total rolls. Format the counts with commas. Format the percentages with two decimal places. Calculate and print the sum of the counts. Also, chart the seven counts in a pie chart using JFreeChart.

Use this line in your code:

frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

Continue to prompt the user for simulations until they enter 0 for the number of rolls. Use this data for the last three simulations and enter the percentages of 6s rolled for each one:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!