Hi, thank you for posting your question here at Brainly.
For consistency you must convert gallons to cubic foot. The conversions are:
7.481 gal = 1 ft3
Then, $3.65 per gallon becomes $27.3 per ft3. If you buy $40 worth of gas, you get $40/$27.3 = 1.46 ft3 of gas.
If you can travel for 4 miles per ft3, then with the amount of gas you have, you can travel up to 5.85 miles.
(4 miles/ft3)*(1.46 ft3) = 5.85 miles