y_1(x) = ((-0.5) * x) + 6
y_2(x) = (1.5 * x) - 6
y_3(x) = (-x) + 31.5
f = Function(y_1, 0, 6)
g = Function(y_2, 6, 15)
h = Function(y_3, 15, 24)
p(x) = If[x  <  15, If[x  <  6, y_1, y_2], y_3]