A) The time to travel 45 miles at a speed of 40 mph can be found from ...
... time = distance / speed
... time = (45 mi)/(40 mi/h) = 9/8 h = 1 hr 7 min 30 sec
B) The gas consumption can be found from ...
... (45 mi)/(54 mi/gal) = 5/6 gal
C) The cost of gas can be found from ...
... ($3.23/gal)×(5/6 gal) ≈ $2.69
_____
The units of the numbers tell you what needs to be multiplied or divided to give the answer quantity with correct units. It pays to keep the units with the numbers. They can be treated as though they were a variable.