converting a density function to a distribution function I get stuck converting density functions to distribution functions, 
(i) the density function $f(y)$ is given by: y (for 0<=y<=1), 1 (for $1<y<=1.5$), and 0 elsewhere. What is $f(y)$? 
I get: (a) $y^2/2$ (for $0<=y<=1$),  and (b) $y$ (for $1<y<=1.5$)
But the answer for (b) is given as $y-1/2$. Could anyone explain how we get $y- 1/2$?
(ii) $f(y) = 1/4$, i.e. $0.25$ (for $-1<y<=0$), $0.25(y-1)$  (for $1 < y <=3$) and  elsewhere. What is $f(y)$?
I get $0.25(y^2/2 - y)$ (for $1 < y <=3$) but when I integrate this using 3 and 1 as the limits and add $0.25$ to this, I don't get $1$.
So I think I am doing something wrong
Would appreciate it if could anyone please help work through these two examples. Thanks 

It is customary to denote the cumulative distribution function of $Y$ as $F_Y(\cdot).$ Sometimes, it is helpful to use a neutral symbol (here $t$) for the variable of
integration.
(i) For $0 \le y < 1,$ we have $F_Y(y) = \int_0^y t\,dt = \frac 1 2 y^2.$
For $1 \le y < 1.5,$ we have 
$F_Y(y) = \int_0^y f_X(t)\,dt = \int_0^1  t\, dt + \int_1^y 1\,dt = \frac 1 2 + y - 1 = y - \frac 1 2.$
What are the values of $F_Y(y),$ for $y \le 0$ and $y > 1.5?$

Now you should be able to do part (ii) on your own.
Addendum, partially checking (ii):  
On $(-1,0),$ we have $F_Y(y) = \int_{-1}^y \frac 1 4 \,dt
= \frac 1 4 [t]_{-1}^y = \frac 1 4 (y-(-1)) = \frac 1 4 (y+1),$ as you say.
So $F_Y(-1) = 0,$ as it must be.
On $(0,1),$ we have $F_Y(y) = \int_{-1}^y f_Y(t)\, dt
= \int_{-1}^0 f_y(t)\, dt + \int_0^y 0\, dt = \frac 1 4 + 0 = 1/4.$
On $(1, 3),$ we have $F_Y(t) = \int_{-1}^y f_Y(t)\, dt
= \frac 1 4 + \int_1^y \frac 1 4 (t-1)\, dt = ??.$ You are correct that 
$F_Y(3) = 1.$
