I have that $X$ is a RV with $P(X=1)=1-P(X=2)=p$ and $Y$ is RV with $ (Y|X=k)\stackrel{d}{=}\mathcal U[0,k]$
First of all, I try to find the joint density: $f(k,y)=f_x(k)f_{Y|X=k}=\frac{1}{2}.\frac{1}{k}=\frac{1}{2k}; k=1,2$
Then, the density of $y$, would be $f_y(y)=\sum \limits_{k=1}^{2}\frac{1}{2k}=\frac{3}{4}$
$E[y]=\int \limits_0^2yf_y(y)dy=\frac{3}{4}\int \limits_0^2ydy=\frac{3}{2}$
I would like to know if this is the way to do it, I am kind of confused since one is discrete and the other one is continuous.
You have probability p that Y=U (0,2) and probability 1-p that Y=U (0,1). So E (Y)=p*1 + (1-p)0.5=0.5 (1+p).