Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Current code I have is #FuelCost.py CPG: float = 6.00 m = float(input(Enter the total miles of the road trip: )) mpg = float(input(Enter the

image text in transcribed

Current code I have is

#FuelCost.py CPG: float = 6.00 m = float(input("Enter the total miles of the road trip: ")) mpg = float(input("Enter the miles per gallon of the vehicle: ")) fuel_cost = m / mpg * CPG print("Total miles of road trip: {:.2f}".format(m)) print("Miles per gallon of vehicle: {:.2f}".format(mpg)) print("Cost per gallon of fuel: ${:.2f}".format(CPG)) print("Fuel cost for the trip: ${:.2f}".format(fuel_cost)) 
how many miles per gallon our vehicle gets (mpg) and the fuel cost per gallon(CPG), we can estimate total costs for fuel required complete our road trip from point A to point B. FuelCost =m/mpgcpg Where, the terms in the formula are: m is total miles of the road trip mpg is miles per gallon of vehicle cpg is the cost per gallon for fuel, which is no longer a 'Named Constant', but instead updated in our Selection Structure In our program logic, cpg is set by the following Selection Structure: Unleaded gas up to 89.00 Octane $6.00 per gallon Unleaded gas over 89.0190.99 Octane $8.00 per gallon Unleaded gas over 91.00 - 94.99 Octane $10.45 per gallon High 0ctane racing fuel, 95.00 - 120.00 0ctane 23.94 per gallon High Octane jet fuel, anything above 120 octane 36.98 per gallon Write a Python program that - takes input: m, and mpg, Octane - Processing: Calculates Fuel Costs (see formula above) - Output: Total miles of road trip, mpg, cpg, Octane and calculated Fuel Costs BE SURE TO DESIGN YOUR SELECTION STRUCTURE WITH NO COMPOUND BOOLEAN EXPRESSION (AND or OR), instead refer to the if-elif-else for range values (refer to pg. 141 - 142), use of a compound Boolean expression in your program logic, even if logically correct, will get points taken off since it is poor programming style when programming Selection Structures for Range values. [10 points] submit FuelCostSelection.py be sure to format your output to 2 decimal places

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions