Write a bluej project- birthday paradox

Assignment Help JAVA Programming
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

Reference no: EM13785173

Questions Cloud

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.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd