Using the experiment in part (a) of Exercise 3.1.19, consider a game when a person pays $\$ 5$ to play. If the trial results in a 1 or 2, she receives nothing: if a 3 , she receives $\$ 1$; if a 4 , she receives $\$ 2$; and if a 5 , she receives $\$ 20$. Let $G$ be her gain.
(a) Determine $E(G)$.
(b) Write $\mathrm{R}$ code that simulates the gain. Then simulate it 10,000 times, collecting the gains. Compute the average of these 10,000 gains and compare it with $E(G)$