In order to figure out if it's a function, it just has to pass the vertical line test. In other words, if there are 2 points of intersection along the graph and the vertical line, then it's not a function. These both pass and are therefore functions.
Then to get the values you just plug x into the function and evaluate depending on which part of the piecewise function it fits into.