Question: Data Structures Make it original Java plz. Javadoc as well. P-1.29 is the exercise. An example of what I want is /** * Purpose: A
Data Structures

Make it original Java plz. Javadoc as well. P-1.29 is the exercise. An example of what I want is
/** * Purpose: A simple program that showcases the Birthday Paradox. * * * Goal: To 'prove' that the probability of similar birthdays is greater after n = 23 * Algorithm: * Track trial numbers ( = 20), adding 5 people(n) to each trial (at trial 5, n = 25) * Process all randomly simulated birthdays into a growing ArrayList each trial. * Document how many occurences are in every random trial, with a value greater than 1 indicating higher probability. * Process: * All pieces are written within the main method, wrapped in a large do-while loop. * - Multiple nested loops that work independent pieces of the process. * Effective as each part have been sectioned off according to their need and appearance in the algorithm. * - ie; trial number counts first, then randomising birthdays to put into the arrayList, followed by counting # of occurences. */
import java.util.Random; import java.util.ArrayList;
public class BirthdayParadox { public static void main(String[] args) { //calculates the trial number (in this case, 20 in total) int trialNumber = 1; //holds the number of people in a given 'room'/trial int n = 0; //counter for the number of similar occurrences int occurences = 0; //checkDate is a static number to assure every trial is controlled int checkDate = 45; do { //beginning trial's starting total; adds 5 people to each new trial n += 5; //array to store rand/omly generated birthdays, from 1-365 (in terms of days, excluding leap years ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
