Reference no: EM13785173
The birthday paradox states that if there are 23 people in a room then there is a slightly more than 50:50 chance that at least two of them will have the same birthday. In this exercise you will write a BlueJ project (birthday_paradox) that will help us empirically test this non-intuitive result. Your project will have just one Java classBirthdayParadox. The details of this class are given below:
· BirthdayParadox.java
o The following fields:
§ int[] days;
§ int numPeople;
§ int times;
o A constructor BirthdayParadox(int numPeople, int numTimes)which takes as input parameters the number of people and the number of times the simulation is to be performed.
o int rndDay() // returns a random day i.e., a random integer from 1..365 (inclusive)
o int once() // perform the simulation once
o void run() // After creating an instance of a BirthdayParadox object using the above constructor invoke the run method to run simulation
Your constructor for BirthdayParadox will take two inputs: the number of people we are testing for and the number of times to repeat the experiment. For each run of the experiment your program will print the number of people it randomly generated before a birthday repeated. It will print the average number of people after completing all the runs. Note that, by default, the BlueJ terminal window will only show the last 50 lines of a program. To show all the lines that are output by your program in the BlueJ terminal window, choose Options and select Unlimited buffering.
Following are two sample outputs of the program:
Output for
1 ---> 65
2 ---> 17
3 ---> 26
4 ---> 32
5 ---> 17
...
96 ---> 47
97 ---> 27
98 ---> 15
99 ---> 22
100 ---> 24
Avg ---> 24.4
Output for
3 people and 200 simulations
1 ---> 89
2 ---> 40
3 ---> 98
4 ---> 36
5 ---> 38
...
196 ---> 79
197 ---> 54
198 ---> 87
199 ---> 144
200 ---> 83
Avg ---> 86.7
Chocolate company net income
: A customer that had an account receivable with the company in the amount of $10,000 called and said they could not pay on time. You, the CFO, told them they could pay it all back in 120 days, but they would need to pay it back with 5% interest. ..
|
What is the z-score for a state score of 226
: What percentage of the students scored below student in Verbal Skills - What percentage of the students scored above student in Mathematics?
|
Consist of legal and fiduciary-oversight-fund-raising
: Responsibilities of a non profit organization's governing board consist of legal and fiduciary, oversight, fund-raising, and representation of constituencies and viewpoints. Address the fund-raising duties of the governing board
|
Meaning of the expression dress for success
: Research, examine, and discuss five positive work habits that are essential to long-term career success. Also, discuss the meaning of the expression "Dress for success." What does this mean to you, and how should you dress for work?
|
Write a bluej project- birthday paradox
: The birthday paradox states that if there are 23 people in a room then there is a slightly more than 50:50 chance that at least two of them will have the same birthday.
|
Identify an issue that needs to be addressed
: You will conduct sufficient web research to select a specific criminal justice-related issue/problem that the management, administration, and/or leadership of a major criminal justice organization are, have, or should beaddressing. Identify an iss..
|
Explain the components of the market research report
: Explain the components of the market research report. Include a company in your explanation and how the final report will be useful to that type of company.
|
Pros and cons of dsm diagnosis
: The Diagnostic and Statistical Manual of Mental Disorders (DSM) was originally developed in 1952 to help doctors and counselors across the country standardize the classifications of mental disorders in the American population. Throughout the inter..
|
Phase of the contract management process
: What are two major types of authority applicable to a contract manager/project manager? Briefly explain each of these authorities.
|