Let $f$ is given by $$ f(x)=\begin{cases} 0,~~~ 0\leq x \leq 1\\ 1, ~~~1<x\leq 2 \\ 2, ~~~2<x\leq 3 \end{cases}$$ If F(x)=$\int_0^xf(x)dx$ for $x\in[0,3]$, find $F$.
Attempt:
As f has only two point of discontinuity, so f is Riemann integrable on $[0,3]$. Then $$ F(x)=\int_0^xf(x)dx=\begin{cases} \int_0^x 0\, dx,~~~ 0\leq x \leq 1\\ \int_1^x 1\, dx, ~~~1<x\leq 2 \\ \int_2^x 2\, dx, ~~~2<x\leq 3 \end{cases}=\begin{cases} 0,~~~ 0\leq x \leq 1\\ x-1, ~~~1<x\leq 2 \\ 2x-4, ~~~2<x\leq 3 \end{cases}$$
Not getting the answer correctly. Please help.
for $2< x \le 3$,
$$\int_0^x f(t) \, dt = F(2)+\int_2^x f(t) \, dt$$