Question
Can someone write javadoc style comments for this program? import java.util.Random; import java.util.ArrayList; public class birthdayparadox { public static void main(String[] args) { int numSimulations
Can someone write javadoc style comments for this program?
import java.util.Random; import java.util.ArrayList; public class birthdayparadox { public static void main(String[] args) { int numSimulations = 10000; int n = 5; Random random = new Random(); while (n <= 100) { int number_of_times_same_birthday_found = 0;
for (int i = 0; i < numSimulations; i++) { ArrayList
if (birthdays.contains(bday)) { number_of_times_same_birthday_found++;
break;
} else { birthdays.add(bday);
}
}
}
double estimated_prob = (double) number_of_times_same_birthday_found / numSimulations; System.out.println("Number of people with same birthdays " + n + ", probability is " + String.format("%.2f", estimatedprobability * 100)+"%");
n += 5;
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started