Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java please, following instructions carefully. Thanks so much!! Write a program called DiceRolls that simulates multiple rolls of two 6-sided dice (use two random

image text in transcribed

In java please, following instructions carefully. Thanks so much!!

Write a program called DiceRolls that simulates multiple rolls of two 6-sided dice (use two random numbers for this) and computes the percentage of the total number for each possible outcome. The program should ask the user how many times to roll the dice and use a loop to simulate that many rolls. The program must use an int array to keep track of how many times each possible roll (i.e., 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12) occurs. You may also find it convenient to use double arrays to handle the observed and expected percentages. After all the "rolls" have been performed, determine what the actual observed percentage of the total number of rolls was for each number. For example, if the dice were rolled 500 times and the value 8 was observed 62 times, then the observed percentage would be 12.40%. However, the expected percentage for 8 is 13.89% (5 out of 36 rolls)-you can find the percentages for other rolls online at several websites, e.g., (http://boardgames.about.com/od/dicegames/a/probabilities, htm). For each possible roll, display the roll value, the observed percentage, and the expected percentage. Display the results to the console as a table, aligning the results in nice even columns using the printf method. For example Enter the number of rolls to be simulated: 130e The percentages observed for 1300 rolls: roll observed expected 2.83% 6.00% 8.12% 2. 78% 5.56% 8.33% 12 2.51% 2.78%

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_2

Step: 3

blur-text-image_3

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago