How to calculate an expected value of maximum random variable function 
*

*Let  $X \sim U(0,1)$
$Y=\max(X,0.5)$
$Z=\max(X-0.5,0)$
$W=\max(0.5-X,0)$


ask how to calculate $E(Y)$, $E(Z)$, $E(W)$
 A: Written to elaborate the already explanatory comment of Dilip Sawarte

Let $X$ be a random variable uniformly distributed on $(0,1)$. This means that $$g_X(x)=1 ~~\text{for}~~ x \in (0,1)$$
We are interested in the expectation of the random variable, $Y=\max\left(X,\dfrac{1}{2}\right)$. 

Now, note that $$\begin{align}\mathbb E(f(X))&=\int_{-\infty}^\infty f(x)g_X(x) \rm{d}x\\&=\int_{0}^1f(x)\mathrm dx\\&=\int_0^{\frac 1 2}\dfrac{1}{2}\mathrm dx+\int_{\frac 1 2}^1x~~\rm dx\\&=\dfrac 1 4+\dfrac 1 2-\dfrac 1 8\\&=\dfrac 5 8\end{align}$$

Similarly other integrals can be evaluated. 
I'll leave only the answers in case you needed to check:
For (b) $\dfrac{1}{8}$
For (c) $\dfrac{1}{8}$
As Dilip Sawarte points out, some graphs you'll find useful are:
for (a):
$\hspace{1 in}$ 
for (b):
$\hspace{1 in}$ 
for (c):
$\hspace{1 in}$ 
Note that the area of the shaded region is the expectation you're in need of!
A: Consider using the formula below with $T$ being the statement that $X>0.5$,
$$ \mathbb{E}(X)=P(T)\;\mathbb{E}(X \;|\; 
T)+P(\text{not } T)\; \mathbb{E}(X \;|\; \text{not }T).$$
For example, for the first case we have
$$\mathbb{E}(Y)=(1/2)\; (3/4)+(1/2)\; (1/2)=5/8.$$
