The birthday paradox says that the probability that two people in a room will have the same birthday is more than half, provided n, the number of people in the room, is more than 23. This property is not really a paradox, but many people find it surprising. Design a Java program that can test this paradox by a series of experiments on randomly generated birthdays, which test this paradox for n = 5, 10, 15, 20,..., 100. Be sure to make your output the same as the output below, use Scanner, # of students, # of trials wanted to run, if you want to see all the matching trials (yes or no), the theoretical probability of a match, found matches, actual percentage, and if you want to run another trial (yes or no). This image is an example of the output:

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter17: Markov Chains
Section17.6: Absorbing Chains
Problem 7P
icon
Related questions
Question

The birthday paradox says that the probability that two people in a room will have the same birthday is more than half, provided n, the number of people in the room, is more than 23. This property is not really a paradox, but many people find it surprising. Design a Java program that can test this paradox by a series of experiments on randomly generated birthdays, which test this paradox for n = 5, 10, 15, 20,..., 100. Be sure to make your output the same as the output below, use Scanner, # of students, # of trials wanted to run, if you want to see all the matching trials (yes or no), the theoretical probability of a match, found matches, actual percentage, and if you want to run another trial (yes or no).

This image is an example of the output:

 

how many students are in the class? 23
how many trials do you want to run? 10
do you want to see all the matching trials (Y or N) ? Y
the theoretical probability of a match is: 0.50730
found match on student 16, month = 4, day = 16
found match on student 17, month = 4, day = 25
found match on student 22, month = 2, day = 20
found match on student 2, month = 7, day = 17
using 23 students and 10 trials, the number where same birthday was present is: 4 which is 40.00%
do you want run another tria1 (Y or N)?
Transcribed Image Text:how many students are in the class? 23 how many trials do you want to run? 10 do you want to see all the matching trials (Y or N) ? Y the theoretical probability of a match is: 0.50730 found match on student 16, month = 4, day = 16 found match on student 17, month = 4, day = 25 found match on student 22, month = 2, day = 20 found match on student 2, month = 7, day = 17 using 23 students and 10 trials, the number where same birthday was present is: 4 which is 40.00% do you want run another tria1 (Y or N)?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole