# Data-Driven Development with Python Summer 2020 Programming Assignment 1 Programming Assignment 1

CS602 – Data-Driven Development with Python Summer 2020 Programming Assignment 1
Programming Assignment 1
Getting started
Read about the course organization and policies (online, from the course site, or in the syllabus that was handed out). Complete the reading and practice assignments posted on the course schedule. Review class handouts and examples. Please remember that you can collaborate on the practice problems, but no collaboration is allowed on the Programming Projects. The only help you can get on a Programming Project, must come from a CIS Sandbox tutor or the course instructor.
This week’s project requires knowledge of only some very basic operations on numeric values. When working on a project always make sure you understand the program requirements first, then think about the algorithm that you will use and write a sketch/diagram of it. Only after you have thought through the details of the algorithm and verified it on a few test cases, should start working on its implementation in Python. Don’t forget to test your program using multiple different test cases.
When working on the program it is important to learn to develop it gradually by implementing one logical step of the algorithm at a time and testing the program after implementing each step.
Programming Project: Jet Fuel worth: 10 points
Your first program assignment requires you to ask for input from a user and then calculate several simple mathematical rate conversions.
The program should get the following information from the user:
•A floating point number denoting the amount of Jet A fuel to be purchased.
The program will then compute and output the following information, including:
•Reprint the value that was input by the user (number of gallons of jet fuel).
•The equivalent number of liters.
•The number of barrels of oil required.
•The number of pounds of CO2 produced.
•The number of BTUs (British Thermal Units) produced.
•Price in US dollars.
•The number of hours and minutes that a 767 aircraft can fly on that amount of jet fuel.
Use the following measures in your final calculations:
•1 gallon is equivalent to 3.7854 liters.
•1 barrel of oil produces 4 gallons of Jet A fuel. FYI, a barrel is 42 gallons.
•1 gallon of Jet A fuel produces approximately 21.095 pounds of CO2.
•1 gallon of Jet A fuel produces 128,100 BTUs.
•1 gallon of Jet A fuel weighs 6.7 pounds.
•The average price for a gallon of Jet A fuel is \$4.48/gallon.
•A 767 aircraft burns 1279 gallons of Jet A fuel per hour.
CS602 – Data-Driven Development with Python Summer 2020 Programming Assignment 1
Here is a sample interaction (user input appears in boldface) This program takes the amount of Jet A fuel in gallons and calculates the following:
1.Equivalent number of liters
2.Number of barrels of oil required
3.Pounds of Carbon Dioxide produced
4.BTUs produced
5.Weight in pounds
6.Total price in US dollars
7.Flight time of a767
Please enter the number gallons of Jet A fuel you wish to purchase: 2734.3456
—— Original number of gallons is: 2,734.35 2,734.35 gallons of Jet A fuel is equivalent of 10,350.61 Liters2,734.35 gallons of Jet A fuel requires 683.59 barrels of oil2,734.35 gallons of Jet A fuel produces 57,681.11 pounds of CO22,734.35 gallons of Jet A fuel produces 350,270,235.00 BTUs ofenergy 2,734.35 gallons of Jet A fuel weighs 18,320.15 Pounds2,734.35 gallons of Jet A fuel costs \$5,140.58—— Total flight time of a 767 aircraft: 2 Hours 08 Minutes
In this project you should not worry about user entering invalid data (for instance, negative values). Your program will be tested with valid input only.
Other Requirements:
You must use named constants (by convention using only uppercase) to represent:
•Liters per gallon conversion value
•Jet fuel per barrel conversion value
•Pound of CO2 conversion value
•Pounds per gallon conversion value
•Price per gallon (US dollars)
•Burn rate of a 767 aircraft (in gallons)
Use these constants in the calculations. Then, if any of these parameters change, in order to make your program produce accurate values, it would be enough to modify the values of these constants.
In this project you should not be using any loops, lists or any data structures not covered by the first week’s material.
The input value from the user should be rounded to two (2) decimal points. Example: 2734.3456 would be rounded to 2734.35.
Format all output as shown in the interaction. When printing floating point numbers, make sure to display exactly two digits after the period (decimal point).
Hint: When determining the flight time of a 767 aircraft you should calculate the total number ofminutes that the jet fuel will last based on the rate of consumption (burn rate) of the aircraft. Then you can use integer division (//) and modulas (%) to calculate the number of hours and minutes. When you calculate the flight time of a 767 aircraft in hours and minutes, if the number of
minutes is less than 10, you need to include a leading zero.
CS602 – Data-Driven Development with Python Summer 2020 Programming Assignment 1
Important Notes
Input and output of your program should appear in exactly the order that is shown and in the format that is shown in the sample interaction.
Remember that the best way to develop a program is by working on it incrementally and periodically verifying the correctness of each developed part. For instance, after developing the code that computes the price, test it on various inputs to make sure that this part works correctly, and after that, proceed with computing the number of classes per day. You can verify that the intermediate values computed by your program are correct by printing them out. This technique is called debugging output. The extra printing statements must later be removed or commented out when the final version of the program is produced.
Finally, after testing your program thoroughly, before you submit, re-read the requirements again to verify that you have not missed anything, close Eclipse, and submit your .py file through Blackboard Assignments page.
The grading schema for this project is as follows:
Your program should compile without syntax errors to receive any credit. If a part of your program is working, you will receive partial credit, but only if the program compiles without syntax errors.
•1 point will be awarded for correctly handling input and output
•1 point for correctly computing the number of liters.
•1 point for the correctly computing the number of barrels of oil.
•1 point for the correctly computing the number of pounds of CO2.
•1 point for the correctly computing the total weight of the jet fuel.
•1 point for the correctly computing the total price of the jet fuel.
•2 points for the correct flight time in hours and minutes of a 767 aircraft.
•2 point will be awarded for good programming style, as defined in Handout 1.
oCommenting, naming and naming conventions, and structuring your code
Created by David Rude on May 20, 2020