Question: Extend the program in Q3a such that, in addition, it asks for the price of gasoline in dollars per gallon. And it computes and prints

Extend the program in Q3a such that, in addition, it asks for the price of gasoline in dollars per gallon. And it computes and prints i) Cost of the drive in terms of dollars per mile and ii) The number of miles the car can continue (after the trip ends) before it runs out of gasoline.

A user session of the program proceeds as follows:

Program Prompt: Enter the odometer reading at the start of the trip in miles

User Response: 100.5

Program Prompt: Enter the odometer reading at the end of the trip in miles

User Response: 200.5

Program Prompt: Enter the amount of gasoline at the start of the trip in gallons

User Response: 20.1

Program Prompt: Enter the amount of gasoline at the end of the trip in gallons

User Response: 17.1

Program Prompt: Enter the price of gas in dollars per gallon

User Response: 2.0

Program Prints:

Miles per gallon for the car is 33.33 The cost of the trip in dollars per mile is 0.06 Total number of miles car can continue is 570.0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!