Define $X:= cube , Y:=coin$ If $Y=H$ the player get $2X$ dollars.If $Y=T$ the player get $\frac{1}{2}X$ dollars. Find the expected value of the gain.

The gain is $G = f(Y)X$ where $f(H) = 2$ and $f(T) = 1/2$. As $X$ and $Y$ are independent, one has \begin{equation} E(G) = E(f(Y)X) = E(f(Y))E(X) = \frac{2 + 1/2}{2}\times 3.5 = 4.375 \end{equation}