If x is the number of hours, and the price per hour is m, then, mx plus the additional fee $18 is the total cost of the service.
If y is the total cost, you have:
y = mx + 18
To determine the value of m consider that for 3 hours, that is, for x=3, y = 54. Replace these values of x and y into the previous equation and solve for m, just as follow:
54 = m(3) + 18
54 = 3m + 18
54 - 18 = 3m
36 = 3m
36/3 = m
12 = m
Hence, the equation that represents the given situation in:
y = 12x + 18