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:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education