Answer
$f(x)=\begin{cases} -1,\ x\le 0 \\ \ \ \ 1,\ x\gt 0\end{cases}$
domain $(-\infty,\infty)$ and range $\{-1, 1 \}$
Work Step by Step
Step 1. Identify the upper line equation as $y=1$ with $x\gt 0$.
Step 2. Identify the lower line equation as $y=-1$ with $x\le 0$.
Step 3. Combine the above to get: $f(x)=\begin{cases} -1,\ x\le 0 \\ \ \ \ 1,\ x\gt 0\end{cases}$
Step 4. Identify the domain as $(-\infty,\infty)$ and range as $\{-1, 1 \}$