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

  Perform a full backup of the adventureworks database

1. Take the command that you made to reorganize your Production.TransactionHistory table, and schedule it to run as a weekend job Sunday mornings at 2AM. 2. Perform a full backup of the AdventureWorks database. Save the backup to C:MyBackup.bak (o..

  The payroll manager for your employer

You are the Payroll Manager for your employer. Your payroll clerk has submitted the worksheet displayed here. All employees earn their regular pay rate times the hours worked plus an overtime bonus of 50% of the hours worked in excess of 40 hou..

  Develope a work breakdown structure

Developing a Work Breakdown Structure. Watch videos 9 thru 13B of the Microsoft Project Tutorial. Read the tutorial and get the link to download Microsoft Project immediately if you did not start the process last week.

  Ethics and compliance officer association

Locate the website for the Ethics and Compliance Officer Association (ECOA). The ECOA makes a public commitment to four key values. What are they? How does the mission of the ECOA differ from that of the ERC?

  Option of trying to score

In American football, teams have the option of trying to score either 1 or 2 extra points after a touchdown. They can get 1 point by kicking the ball through the goal posts or 2 points by running or passing the ball across the goal line

  Output of the commands and the diagram

Combine both the output of the commands and the diagram to make your configuration changes to resolve the issues that have been documented.

  Draw a class diagram representing a book

Draw a class diagram representing a book defined by the following statement: "A book is composed of a number of parts, which in turn are composed of a number of chapters. Chapters are composed of sections." Focus only on classes and relationships.

  Are an itg and an sqa group made up of the same people

Are an ITG and an SQA group made up of the same people?

  What is the minimum required sampling rate

It is necessary to transmit the human voice using a frequency range from 300 Hz to 3.5 kHz using a digital system.

  Key innovation of crypto-currency

It is well known that the key innovation of crypto-currency (such as Bitcoin, Ethereum) is distributed consensus protocol.

  Explain the issues that exist between 3nf and bcnf

Explain the issues that exist between 3NF and BCNF.  Now normalize through BCNF.  Show the relations at each step even if there is no change so I can see the process.

  Create a plot of a cubic spline fit

Create a plot of a cubic spline fit of following data with natural end conditions: x 0 100 200 400f(x) 0 0.82436 1.00000 0.73576. compare the plot with the following equation which was used to create data.

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