Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92524990
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Create login form to enter user name and a password textbox

Create login form to enter user name and a password textbox to enter password, and write procedure to simulate the process of triggering the login process after hitting the Enter Key.

Is it ethical for facebook to mine its users posts for

Is it ethical for Facebook to mine its users' posts for signals that those users are about to go through a break up? Is it ethical for the company to then help its clients target their ads based on this research? Is what ...

Suppose that alices rsa parameters are ma91 ea7 and da31

Suppose that Alice's RSA parameters are m_A=91, e_A=7, and d_A=31. And suppose that Bob's RSA modulus is m_B=187. a)If Bob's public exponent is e_B=13 and Alice wants to encrypt the message signature pair (x, delta)=(70, ...

Command to mail only the process id of running java program

Command to mail only the process ID of running Java program test to the email address (single line Unix)

Find minimal dfas for the following languages in each case

Find minimal dfa's for the following languages. In each case prove that the result is minimal. (1) L = {a n bm> :n≥2,m≥1}. (2)L = {a n :n ≥ 0,n ≠ 3} (3) L = {a n :n mod 3 = 0}∪{a n : n mod 5 = 1}

Suppose that you are given a sorted list of n elements

Suppose that you are given a sorted list of n elements followed by f(n) randomly ordered elements. How would you sort the entire list if a. f(n) = 2? b. f(n) = vn? c. How large can f(n) be for the entire list to be sorte ...

Remember all of the following steps when showing that a

Remember all of the following steps when showing that a problem D is NPcomplete: 1. Show that D is in NP by briefly explaining how to quickly verify a solution to it. 2. Choose another problem Q that is known to be NP-ha ...

Are risk-averse people more likely to order their steak

Are risk-averse people more likely to order their steak well-done? A survey was conducted that asked individuals a series of questions about risk and how the individual prefers their steak (if at all). In particular, one ...

Show the entries for the header of a udp user datagram that

Show the entries for the header of a UDP user datagram that carries a message from a TFTP client to a TFTP server. Fill the checksum field with zeros. Choose an appropriate ephemeral port number and the correct well-know ...

The inflation rate is 20 per year the real rate of return

The inflation rate is 2.0% per year. The real rate of return is 2.5% per year. A perpetuity that paid $100 this year will provide income that grows by the inflation rate. What is the value of the perpetuity?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As