Write test program that computes and prints out probability


The Birthday Problem The Birthday Problem is stated as follows: if there is a group of n people in a room, what is the probability that two or more of them have the same birthday? It is possible to determine the answer to this question by simulation. Write a function that calculates the probability that two or more of n people will have the same birthday, where n is a calling argument. (Hint: To do this, the function should create an array of size n and generate n birthdays in the range 1 to 365 randomly. It should then check to see if any of the n birthdays are identical. The function should perform this experiment at least 5000 times and calculate the fraction of those times in which two or more people had the same birthday.) Write a test program that calculates and prints out the probability that two or more of n people will have the same birthday for n 2, 3, . . . , 40.

Request for Solution File

Ask an Expert for Answer!!
Mechanical Engineering: Write test program that computes and prints out probability
Reference No:- TGS0726986

Expected delivery within 24 Hours