Question: Let's update our Modularize version of Fuel Cost Python Program, FuelCostModularized.py, but instead of getting our input from the keyboard and outputting our results to

 Let's update our Modularize version of Fuel Cost Python Program, FuelCostModularized.py,but instead of getting our input from the keyboard and outputting our

Let's update our Modularize version of Fuel Cost Python Program, FuelCostModularized.py, but instead of getting our input from the keyboard and outputting our results to the console, let's instead get our input from a file (Input File provided in this lab and contains m (miles); input mpg and Octane). and output our results to another separate output file. Our new program name will be: FuelCostFilelO.py. BE SURE TO INCLUDE EXCEPTION AND EXCEPTION HANDLING (section 6.4). Also, be sure to convert the input from a file to a number so it can be used in our calculation modules. See updates in blue. 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. 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, set in our Selection Structure In our program logic, cpg is set by the following Selection Structure: Unleaded gas up to 89.00 0ctane $6.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 0ctane racing fuel, 95.00120.00 0ctane 23.94 per gallon High 0ctane jet fuel, anything above 120 0ctane 36.98 per gallon re-use the modules we created last week calcCpg(Octane) calcFuelCost(m,mpg,cpg) - Write a Python program that - takes input: Continues to take input from a file: FuelRecordsInput.txt _. (Iteration loop structure) for m (miles); input mpg and Octane, until the end of a file is reached. See section 6.3 and Program 6-14 Reading and Processing records from a file. A group of 3 lines =1 record, 1 st line is miles (m)2 nd line is miles per gallon ( mpg) and 3rd line is - Write a Python program that - takes input: Continues to take input from a file: FuelRecordsInput.txt (Iteration loop structure) for m (miles); input mpg and Octane, until the end of a file is reached. See section 6.3 and Program 6-14 Reading and Processing records from a file. A group of 3 lines =1 record, 1 st line is miles (m)2nd line is miles per gallon (mpg) and 3rd line is Octane. The input file contains 6 records. - 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 to output file named: FuelCostOutput.txt [0 points] re-submit Fuel.py (contains our modules) so I can run this weeks submission [15 points] submit FuelCostFilelO.py, that includes Exceptions and Exception Handling, in the case the File is not found, or Cannot write to a file because of permissions, etc.... ***note: put input file and Python program in same directory so we don't have to fully path our files

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!