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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started