Python program that calculates the amount of oil

Assignment Help Basic Computer Science
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.

Reference no: EM131716298

Questions Cloud

What are the explanations that have been offered : What are the explanations that have been offered in support of dropping the atomic bomb? What is your response to these explanations?
Differences between these two violent incidents : What were the similarities and differences between these two violent incidents?
Exposure to trauma that is real or threatened : Exposure to trauma that is real or threatened, Anxiety is created by the fear of social interactions
Test the hypothesis of the average percentage : A company claims that on average, when exposed to its toothpaste, 45% of all bacteria related to gingivitis is killed.
Python program that calculates the amount of oil : 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:
What are the differences between an agent and an employee : What are the differences between an agent and an employee? Are there different obligations? Can an employee also be an agent?
Use data mining to help marketing managers specifically : Write a report (at least 400 words) on how to use data mining to help marketing managers specifically.
Marketing research survey : What type of questions do you add to a marketing research survey? What is the importance of goal setting to making effective decisions related to your career?
Explain how many enrolled members are there in the tribe : Explain How many enrolled members are there in the tribe? What form of government do they practice? Can both men and women be on the governing body?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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