Jerry’s Appliance has a special promotion for its week long Anniversary Sale. After Customers have picked out the merchandise they wish to buy, they can draw three balls from an urn to determine the sum of the discount they will receive on their purchase. The balls value is as follows Yellow =1 Blue =2 Red = 3 Purple =4 Orange =5 Green = 6 Maroon=7 and Black=8. There are three balls of each color in the urn. The balls are drawn without replacement by each customer but returned to the urn before the next customer draws.
Jerry would like you to simulate 1000 sets of random draws storing the sums in a tally array. Print out the values of the tally array along with an analysis of the cost of the promotion.
Remember this is random choice without replacement (Hint: swap chosen ball with last ball and remove last ball from choices ( Do this twice).
Run this program 1000 times keeping track of the result in a tally array
(Hint : tally[score]++;
Then print out results for each possible value
Score 0 0
Score 1 0
Score 2 0
Score 3 1
Score 4 3
………
Score 24 1
The expected discount is _____%
Build a vector or an array ( probably called Urn) size [24]
Create a rand object range to start at 24 , 23, 22
For loop for 1000 draws
Add the value of three balls to give discount
Tally Array counts the occurrence of each answer
Tally Array [25] note 0,1,2,are always going to be empty
int tally [25] = {0};
total = ball1+ball2 +ball3;
tally[total]++;
grandtotal +=total
average = grandtotal /draw
median = middle value
mode = highest tally
Average = median = mode It is a normal distribution
Your print to monitor is a list of the the tally array and the average