Answer
$\mathrm{See\:the\:attachment\:below.}$
Work Step by Step
$a).$ Find the equation of line that goes through the points $\ (0,2)\ \ \mathrm{and}\ \ (2,0)\ $ and the line that goes through $\ (2,1)\ \ \mathrm{and}\ \ (5,0).$ Secondly, write down the domain restrictions.
$\mathrm{First\:part:}$
$y-1=\frac{0-1}{0+1}(x+1)$
$y=-x\ \ $ on $\ \ [-1,0)$
$\mathrm{Second\:part:}$
Equation of the horizontal line is $\ y=1\ $ on $\ (0,1].$
$\mathrm{Third\:part:}$
$y-1=\frac{0-1}{3-1}(x-1)$
$y=-\frac{1}{2}x+\frac{3}{2}\ \ $ on $\ \ [1,3)$
$b).$ Find the equation of line that goes through the points $\ (-2,-1)\ \ \mathrm{and}\ \ (0,0)\ $ and the line that goes through $\ (0,2)\ \ \mathrm{and}\ \ (1,0).$ Secondly, write down the domain restrictions.
$\mathrm{First\:part:}$
$y+1=\frac{0+1}{0+2}(x+2)$
$y=\frac{1}{2}x\ \ $ on $\ \ [-2,0]$
$\mathrm{Second\:part:}$
$y-2=\frac{0-2}{1-0}(x-0)$
$y=-2x+2\ \ $ on $\ \ (0,1]$
$\mathrm{Third\:part:}$
Equation of the horizontal line is $\ y=-1\ $ on $\ (1,3].$