/*********************************************************************
* Name:
* NetID:
* Precept:
*
* Description: How many people do you need to ask until you find two
* with the same birthday? Let's simulate!
*
* Note: In this program, birthdays are represented as integers 0-364,
* where 0 = Jan 1.
*
* Examples:
* > java Birthday
* 22
* > java Birthday
* 29
* > java Birthday
* 28
*********************************************************************/
public class Birthday {
public static void main(String[] args) {
// this variable keeps track of the number of people we've asked so far
int numPeople = 0;
// this array will associate true or false with each possible birthday
boolean[] seenBefore = new ___________________;
while (true) { // same as: while (1 < 2)
// to simulate, let's pick a birthday at random,
// represented as an int between 0 and 364
int dayNum = ____________________________________________;
// if we've seen this dayNum in a previous iteration,
// leave the loop immediately
if (_________________________________) ____________________;
// update seenBefore[], for future iterations of this loop
seenBefore[____________] = ___________________________;
// increment number of people
// we do this at the end because if we randomly generated
// a duplicate birthday above, we don't want to count that
___________________________________________________________;
}
// so, how many people did you need to find two with the same birthday?
System.out.println(______________________);
}
}