Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A water tank contains a number of water gallons. A water tap increases the number of gallons at a rate of rate In per minute

image text in transcribed
A water tank contains a number of water gallons. A water tap increases the number of gallons at a rate of rate In per minute and a second tap decreases the number of gallons at a rate rateOut per minute. Write a program that promts the user to enter the number of water gallons, the value of rateIn, and the value of rateOut. The program calculates and prints the time needed to empty the tank. For example if the number of gallons, is 15 gallons, rateln is 0.03 and rateOut is 0.07, then after one minute the first tap adds 10*0.03 = 0.45 gallons, while the second tap drains 15*0.07 = 1.05 gallons, so a number gallons, after one minute is 15 + 0.45 - 1.05 = 14.4 gallons. Sample inputs/outputs: Enter the water quantity: 15 Enter rate in and the rate out: 0.1 0.8 The time to empty the tank is 89 minutes

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions