Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program which requests and reads three double values. The first are the the diameter and height of a cylindrical bucket, given in

Write a C++ program which requests and reads three double values. The first are the the diameter and height of a cylindrical bucket, given in centimeters. The third is a (constant) fill rate for the bucket, given as milliliters per second. The program then reports the amount of time needed to fill the bucket with water at the stated rate.

The calculation is straightforward. The volume of the bucket is

v=hr2

where r is the radius of the base (half the diameter). The volume, v, is in cubic centimeters. Since a cubic centimeter is a milliliter, you can divide v by the flow rate to get the time for that volume to flow into the bucket.

For instance:

[user@home asst1]$ ./fill Enter bucket height (cm): 10 Enter diameter (cm): 4 Enter fill rate (ml/s): 20 Bucket of diameter 4 cm and 10 cm tall filling at 20 ml/s will fill in 6.28318 seconds. [user@home asst1]$ ./fill Enter bucket height (cm): 60 Enter diameter (cm): 40 Enter fill rate (ml/s): 12 Bucket of diameter 40 cm and 60 cm tall filling at 12 ml/s will fill in 6283.18 seconds. [user@home asst1]$ ./fill Enter bucket height (cm): 65 Enter diameter (cm): 45 Enter fill rate (ml/s): 250 Bucket of diameter 45 cm and 65 cm tall filling at 250 ml/s will fill in 413.512 seconds. [user@home asst1]$ ./fill Enter bucket height (cm): 150 Enter diameter (cm): 30 Enter fill rate (ml/s): 900 Bucket of diameter 30 cm and 150 cm tall filling at 900 ml/s will fill in 117.81 seconds.

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

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

Students also viewed these Databases questions

Question

2. Why?

Answered: 1 week ago

Question

1. Where do these biases come from?

Answered: 1 week ago