Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer in Java Objective To practice the use of random number generation and loops. Problem Your friend plays a game of chance based on the

Answer in Java image text in transcribed
Objective To practice the use of random number generation and loops. Problem Your friend plays a game of chance based on the sum of the rolls of three six-sided dice. Clearly the totals can range between three (all ones) and eighteen (all sixes), however, your friend decides he wants to know the probability of each value appearing. Rather than do the mathematics he decides to find out by trials. He rolls the dice 1,000 times and counts the number of threes that occur. Then he rolls the dice another 1,000 times and counts the fours and so forth. You decide you'd rather him play Frisbee Golf with you and so you decide to model his process using a program. Writing and running the program will be faster than his method of finding the probabilities. Your program should output the count of each number in sequence, just as he would do. Implementation There are clearly better ways of doing this. Model the process your friend uses as closely as possible to convince him that your answer would be the same as his. Specifically, don't use multiple counters or arrays (even if you know what those are). You should use the entered value as the seed in a Random Sample input and output Enter a random seed: 54678 The value 3 occurred 2 times. The value 4 occurred 11 times. The value 5 occurred 28 times. The value 6 occurred 42 times. The value 7 occurred 72 times. The value 8 occurred 103 times The value 9 occurred 127 times. The value 10 occurred 122 times. The value 11 occurred 116 times. The value 12 occurred 122 times. The value 13 occurred 94 times. The value 14 occurred 74 times. The value 15 occurred 45 times. The value 16 occurred 23 times. The value 17 occurred 17 times. The value 18 occurred 4 times

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

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions