Question: Ex 2. Birthday Problem (30 points) What is the probability that students in your OOP class have the same birthday (same day and month)? The

 Ex 2. Birthday Problem (30 points) What is the probability that

Ex 2. Birthday Problem (30 points) What is the probability that students in your OOP class have the same birthday (same day and month)? The probability might be higher than what you think! This is a well-known paradox in probability theory. You will write in this exercise a program to estimate how many random people on average you need to meet before meeting someone with the same birthday as someone you met before. Assume that birthdays are represented as numbers from to 365. For example: January 1 is January 2 is 1, January 3 is 2. December 31 is 365 A. Implement function int mimic() that keeps generating random birthdays (numbers between 0 and 365 inclusive) and stops when a birthday is generated for a second time. The function returns the number of birthdays that were generated Hint: You can use a boolean array to keep track of which birthdays have not been seen before B. Write a program that calls mimic() 1908 times and then prints the average of the results retumed by the function. ! Info. The probability of two students in a class of size 30 to have the same birthday is around 70%. If the class size is 50, the probability is around 97%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!