Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume you have three fair dices. Each dice has six surfaces labeled 1 through 6. Calculate the probability that the sum of three dices is

Assume you have three fair dices. Each dice has six surfaces labeled 1 through 6. Calculate the probability that the sum of three dices is greater than or equal to 10 (the sum should be between 3 and 18) when you throw these three dices. Writes a Java program to solve the above probability problem with Monte Carlo method (I do not need the mathematical solution. I just need the experimental solution). The program should have 10 producers and 1 consumers. They share a bounded buffer that can store 5 integers. Each producer will do 1,000,000 experiments. In each experiment, the producer generates 3 random numbers between 1 and 6 and check if the sum is greater than or equal to 10. Each producer needs to send the count (how many times the sum is greater than or equal to 10) to the consumer through the bounded buffer. Each of producers needs to send the count after 10,000 experiments (since each of them will do 1,000,000 experiments, each needs to send counts 100 times). The consumers will keep fetching the counts from the buffer and calculate the probability and prints the result after receives 100 counts. The program needs to synchronize the consumers and producers properly.

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

2. What does the investment spending category of GDP measure?

Answered: 1 week ago