Display a message asking the user the capacity of the tank

Assignment Help Python Programming
Reference no: EM132356662

Question

You need this program in python language

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.

Reference no: EM132356662

Questions Cloud

Describe the best method of disseminating the results : Sharing results makes the case for your decisions. It also adds to the body of knowledge, which creates opportunities for future practitioners. By presenting.
Human resources and operational design : Determine the top three functions of the Human Resources Department and then explain why you believe they add value to the business model.
Determining the viability of cooperative venture : Identify five risks inherent in cooperative venture and conduct cost-benefit analysis when determining the viability of cooperative venture
Undertake an inspection of head office : What 3 actual or potential environmental sustainability and resource usage issues can be found during this activity?
Display a message asking the user the capacity of the tank : Write a Python program that calculates the amount of oil remaining in a tank. Display a message asking the user the capacity of the tank.
Satisfied stakeholders as critical success factor in project : Paper on satisfied stakeholders as a critical success factor in project management
How can you cope with such issues as retention : What are some issues you are likely to encounter with a study that focuses on childhood disease and illness? For example, what ethical and legal issues.
Write a test program that prompts the user to enter a list : Write a test program that prompts the user to enter a list of integers and an integer x. Invoke the function to return the number of integers in the list.
Discuss alternatives to ease the drain on medicare resources : Medicare is an area that often gets overlooked and is seen as a burden financially. Discuss alternatives to ease the drain on Medicare resources.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd