Instruction
If you have ever collected hockey cards (or other sports cards) you may have wondered how many packages you have to buy to get a complete set. In this assignment, we will try and find out.
Let’s start with some assumptions to pin down the problem. First, we will assume that a complete set consists of 500 different cards. You buy cards in packages of 7.
We will assume that the frequency of the cards follows a uniform distribution. That is, assume that the manufacturer produces the same quantity of each card so that the probability of getting any specific card is the same as any other. (This assumption may not be realistic, but we make it to simplify the problem.)
Assignment
Your task is to write a program that simulates buying packages of cards until the set is complete. At each step of the program, you should simulate the act of “buying a package of cards”. For each card you buy, you should keep
track of how many copies of it you have in your collection. An experiment consists of repeating this process until you have a complete set of cards.
For each experiment, you should output the maximum number of duplicates you have of any card. There may be several cards with the same maximum number but you only have to output one of these.
You are to run at least 100 experiments to determine how many packages you expect to have to buy in order to complete the set. When you are finished the experiments, you should output the following information:
1. The average number of packages you had to buy.
2. The maximum number of packages you had to buy to complete your
set.
3. The minimum number of packages you had to buy to complete your
set.