Solved: Java console application that repeatedly rolls a seven-sided die

$30.00

Category:

Description

Solved: Java console application that repeatedly rolls a seven-sided die

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 doesn’t 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:


error: Content is protected !!