Reference no: EM131716298
PROBLEM DEFINITION:
Write a Python program that calculates the amount of oil remaining in a tank. When the program runs, the following it should do the following:
1) Initialize fill counter to zero and take out counter to zero
2) Display a message asking the user the capacity of the tank
3) Read the capacity of the tank from the keyboard
4) Repeat until an amount less than or equal to the capacity is entered a) Display a message asking the user to enter number of gallons of oil in the tank. b) Read the number of gallons of oil in the tank from the keyboard
5) Enter a loop that runs until the amount of oil in the tank is zero or user says "no more". Inside the loop do:
a) Ask the user to say if they are filling in more oil or taking out oil
b) Read user response
c) If filling more oil and amount being added plus amount in tank does not exceed capacity i. Add the amount being added to the amount in the tank ii. Add 1 to fill counter
d) Else if amount being taken does not cause amount in tank to be negative i. Subtract the amount being taken out from the amount in the tank ii. Add 1 to take out counter
e) As user if there is more oil to fill or take out
f) Read user response
6) Display: "Number of oil fill ups " fill-counter
7) Display: "Number of oil draw outs " takeout-counter
8) Display: "Oil balance: " oil remaining in tank
THE PYTHON PROGRAM
The program should do what is specified in the PROBLEM section above. The program should have the following features:
1) The first few lines of your program should be comments that state the program name, the author's (your) name, date the program is released, and a brief description of the main task performed by the program.
2) Your program should have meaningful variable names (names should not be single letter or abbreviations for example a is not a good name but oilAdded is a good name). There should be a comment on each major function point such as: variable declarations, input, start of if or elif or else, loop, calculation, output.