Expectation of $Y := \min\{\frac{a}2, X\}$ if $X$ is uniform on $(0,a)$ The density of X is given by
$
f(x)=
\begin{cases}
 \frac{1}{a}&\, 0 \leq x < a\\
 0&\, otherwise\\
\end{cases}
$ 
Y := min{$\frac{a}{2}$, X} so Y belongs to [0, $\frac{a}{2}$]
Based on this solution, $E(Y) = \frac{3a}{8}$. Why is $E(Y) = \frac{3a}{8}$?
My Work
$
F_Y(y)=
\begin{cases}
 \frac{y}{a}&\, 0 \leq y < \frac{a}{2}\\
 1&\, y \geq \frac{a}{2}\\
\end{cases}
$ 
$
(F_Y(y))' = f_Y(y)=
\begin{cases}
 \frac{1}{a}&\, 0 \leq y < \frac{a}{2}\\
 0&\, y \geq \frac{a}{2}\\
\end{cases}
$ 
$
E(Y) = \int_{0}^{\frac{a}{2}} yf(y) dy = \int_{0}^{\frac{a}{2}} \frac{y}{a} dy = \frac{a}{8}
$

A different approach would be:
$$EY=E\left[Y|X<\frac{1}{2}a\right]+E\left[Y|X\ge\frac{1}{2}a\right]= \int_0^{\frac{1}{2}a}x\frac{1}{a}dx= 0.125a+ 0.5a=\frac{3}{8}a$$
It relays on the properties of conditional expectations.
