/********************************************************************* * Name: * Login: * Precept: * * Description: Reads an integer command-line argument D and simulates * the number of people with random birthdays (among D days) that enter * a room until two share a common birthday. * * Examples: * > java Birthday 365 * 22 Booksite Creative Exercise 1.4.35 *********************************************************************/ public class Birthday { public static void main(String[] args) { // number of days int D = _________________________________________; // number of people who have entered the room int people = 0; // we will later set days[d] = true if a person has birthday d // though all these values initially start as false _______________[] days = new _______________________; // repeat until two people have the same birthday while (true) { // increment number of people people _________; // random day between 0 and D-1 int d = _________________________________________________; // if another person shares birthday d, break out of loop if (______________________) ____________________; // update days[] to indicate person has birthday d days[_____] = __________________; } // print result -- how many people entered the room before you // found a duplicate? System.out.println(_______________________________); } }