Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

What risks are associated with hedging? AppendixLO1

Answered: 1 week ago

Question

Question Can any type of stock or securities be used in an ESOP?

Answered: 1 week ago

Question

Question Can a self-employed person adopt a money purchase plan?

Answered: 1 week ago