Question: In Java. Your program should run 5000 trials. For each trial, it should generate 100 coin tosses and store them in an array; using the
In Java.
Your program should run 5000 trials. For each trial, it should generate 100 coin tosses and store them in an array; using the array, you can compute for that trial how many runs of 'hhhh' are followed by a head, and the ratio of the two numbers. For example, the following trial contains 9 runs of 'hhhh' but only 3 of them are followed by another 'h', giving us a ratio of 0.33333333333
After the 5000 trials the program should print the average of the ratios. You should expect that the average should be about 0.41.
Experiment with your code and see what happens as the trials get shorter (eg, 20 coin tosses) or longer (1000 or more). In all cases, make sure you are running at least 5000 trials, so that the averages that you compute are meaningful.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
