What am I doing wrong with this CDF?

All I'm trying to do is find the CDF of $f_{X+Y}(z)=\begin{cases}\frac z2 & 0\le z\le1\\ \frac12 & 1\le z\le2\\ \frac{(3-z)}{2} & 2\le z\le 3\\ 0 & \text{elsewhere} \end{cases}$

But I cant seem to figure it out. I know what the answers are but for whatever reason I cant get them. I thought to get them we simply do: $$\int_0^z\frac x2dx$$ Which I know is right, but then I go to the next one and tried a variety of different bounds and I couldn't get the right answer. So if someone could explain in general the process of finding CDF's and point out where I was going wrong that would be great.

-
A cdf is always between $0$ and $1$, is non-decreasing, and approaches $0$ as $x\to -\infty$, approaches $1$ as $x\to\infty$. Yours decreases in the third part. You indicate this is the cdf of $X+Y$ but do not indicate what the distributions of $X$ and $Y$ are. There are two basic methods, double integral and convolution. I prefer the first for an introduction, and think from earlier stuff I saw that your instructor is using convolutions. – André Nicolas Dec 4 '12 at 8:42

Let us call $Z=X+Y$. Then we aim at finding $F_Z(z)=P(Z\leq z)$. You have to deal with different values of $z$ seperately. For instance if $z<0$ we have $$P(Z\leq z)=\int_{-\infty}^z f_Z(x)\,\mathrm dx=\int_{-\infty}^z0\,\mathrm dx=0$$ because $f_Z(x)=0$ when $x<0$. If instead $0\leq z\leq 1$, we have $$P(Z\leq z)=\int_{-\infty}^z f_Z(x)\,\mathrm dx=\int_{-\infty}^0 0\,\mathrm dx+\int_0^z\frac{x}{2}\,\mathrm dx,$$ and if instead $1\leq z\leq 2$, then $$P(Z\leq z)=\int_{-\infty}^00\,\mathrm dx+\int_0^1\frac{x}{2}\,\mathrm dx+\int_1^z\frac{1}{2}\,\mathrm dx$$ etc. I hope you see the pattern, otherwise leave a comment.
I actually am having a little problem here. When I get to adding the last part $$P(Z\leq z)=\int_{-\infty}^00\,\mathrm dx+\int_0^1\frac{x}{2}\,\mathrm dx+\int_1^2\frac{1}{2}\,\mathrm dx+\int_2^z\frac{3-x}{2} dx$$ Does the upper bound ever change? I cant seem to get the right CDF part for when $2\le z\le 3$ for some reason. – TheHopefulActuary Dec 4 '12 at 9:29
What do you mean by the upper bound not changing? I get $$P(Z\leq z)=-(1/4)z^2+(3/2)z-(7/4)$$ when $2\leq z\leq 3$. – Stefan Hansen Dec 4 '12 at 9:34