Question: Current Code : #FuelCostLoop.py def calculate_fuel_cost(m, mpg, octane): if octane 120: cpg = 36.98 fuel_cost = m/mpg * cpg return fuel_cost m = float(input(Enter the

 Current Code : #FuelCostLoop.py def calculate_fuel_cost(m, mpg, octane): if octane 120:cpg = 36.98 fuel_cost = m/mpg * cpg return fuel_cost m =

Current Code :

#FuelCostLoop.py def calculate_fuel_cost(m, mpg, octane): if octane 120: cpg = 36.98

fuel_cost = m/mpg * cpg return fuel_cost

m = float(input("Enter the total miles of the road trip: "))

while m != 0: mpg = float(input("Enter the miles per gallon of the vehicle: ")) octane = float(input("Enter the octane level: "))

fuel_cost = fuel_cost(m, mpg, octane)

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(fuel_cost/m*mpg)) print("Octane level: {:.2f}".format(octane)) print("Fuel cost for the trip: ${:.2f}".format(fuel_cost))

m = float(input("Enter the total miles of the road trip: "))

"we will create our own custom modules AND use Python modules delivered with the Python standard library :) Calculate the Fuel Costs for a Road Trip Fuel Costs We can estimate the cost of fuel for a Road Trip with a given number of inputs. If we know total miles our Road trip (m), 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. create a module to determine cpg value create a module to calculate FuelCost =m/mpgcpg \#returns the Cost Per Gallon (cpg), takes in Octane value as a parameter def calcCpg(Octane) \#returns the value for the Fuel Cost of a trip. takes in miles, miles per gallon and cpg as parameters def calcFuelCost(m,mpg,cpg) 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, set in our Selection Structure In our program logic, cpg is set by the following Selection Structure: Unleaded gas up to 89.00 0ctane $8.00 per gallon Unleaded gas over 89.01 - 90.99 0ctane $8.00 per gallon Unleaded gas over 91.00 - 94.99 Octane $10.45 per gallon High octane racing fuel, 95.00120.00 0ctane 23.94 per gallon High Octane jet fuel, anything above 120 0ctane 36.98 per gallon import the math module (section 5.9) and use the ceil() function on the Calculate Fuel Cost value, to output the next higher (rounded up) integer value of Fuel Cost. Write a Python program that import the math module (section 5.9) and use the ceil() function on the Calculate Fuel Cost value, to output the next higher (rounded up) integer value of Fuel Cost. Write a Python program that - takes input: Continues to take input until a sentinel value of O is entered (Iteration loop structure) for m (miles); input mpg and Octane - Processing: Determine cpg by calling our cpg() module, Calculates Fuel Costs by calling or running our module: calcFuelCost() - Output. Total miles of road trip, mpg, cpg, Octane and calculated Fuel Costs,_ceil() of calculated Fuel Cost for each trip Psuedocode: input m, repeat while m!=0 input mgp input 0ctane cpg=calcCpg(0ctane) totalFuelcost = calcFuelCost (m,mpg,cpg) output "A trip of " +m+ " at " + mpg + "miles per gallon at a cost of " + cpg + "per gallo n of Octane " + Octane + " will Round up to a total cost of Fuel at \( \$ "+ \)quot;+ ceil(totalFuelCost) input m end. output "End of Program" [5 points] submit module Fuel.py (contains our Fuel functions: cpg() and calcFuelCost()) [15 points] submit FuelCostModularized.py , be sure to import Fuel, and math modules **be sure to format your output to 2 decimal places..... Post Question in Class Chat room. "Exam Notes*: Local Variables, Global Variables and Constants, math module

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!