Write a simulator in which one round of simulation involves


Programming in C Biased Coin Problem

Write a simulator in which one round of simulation involves flipping a set of ten unfair coins (or the same unfair coin ten times) in which there is a fixed likelihood of any given flip coming up heads.

The result of each round is the number of times that a head appeared, so if in a particular round there were four heads, the result for that round would be four.

You will ask the user for the bias (the percentage chance that a coin will come up heads) and for the number of rounds to perform.

After running the simulation you will report how many times each outcome resulted as well as the percentage of the time it occurred.

Your output should look very similar to the following (in particular, it should be well formatted):

What is the coin bias (percent chance of coming up heads)? 75

How many rounds? 1000000

COINS..... 10
BIAS...... 75.00%
ROUNDS.... 1000000

SUM ROUNDS PERCENTAGE
0    0             ( 0.00% )
1       24            ( 0.00% )
2      360           ( 0.04% )
3     3187          ( 0.32% )
4    16221         ( 1.62% )
5    58108         ( 5.81% )
6   146347        ( 14.63% )
7   249823        ( 24.98% )
8   281878        ( 28.19% )
9   187655        ( 18.77% )
10 56397          ( 5.64% )

Add a histogram to the output.

Following each line in the report you will print out a line of asterisks whose length is proportional to the percentage of the time that result came up. If the frequency was less than 1%, do not print any asterisks.

Then print an additional asterisk for each additional two percentage points (so the boundaries should be odd percentage points).

What happens should an amount fall exactly on the boundary (say 53% exactly) is not important as far as whether a new asterisk is added or not.

The output should now look something like:

What is the coin bias (percent chance of coming up heads)? 63.4

How many rounds? 10000

COINS..... 10
BIAS...... 63.40%
ROUNDS.... 10000

SUM ROUNDS PERCENTAGE
0       0               ( 0.00% )
1       7               ( 0.07% )
2      57              ( 0.57% )
3     261             ( 2.61% )   *
4     822             ( 8.22% )   ****
5     1765           ( 17.65% ) *********
6     2436           ( 24.36% ) ************
7     2372           ( 23.72% ) ************
8    1604            ( 16.04% ) ********
9     572               ( 5.72% ) ***
10   104               ( 1.04% ) *

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a simulator in which one round of simulation involves
Reference No:- TGS02901365

Expected delivery within 24 Hours