That sounds about right. For absolute value problems, you should always break it up into two cases.
Here,
Case 1: k >= 0 --> abs(k) = k
You are left with evaluating the slope between the points (2, k) and (4, k) -> m= 0
Case 2: k < 0 --> abs(k) = -k
You are left with evaluating the slope between the points (2, -k) and (4, k) -> m = +k.