In: Computer Science
Flow chart. Create a flowchart for each situation using
Flowgorithm,
Microsoft Word, Microsoft PowerPoint or handwritten (handwritten),
with legible handwriting.
1. Cylinder Volume (If) (15 pts.)
to. Declare and initialize the required variables and required
constants.
b. Declare Pi as constant, declare it the correct way, according to
its value, and
assign it the value of.
c. Declare the variable for the volume of the liquid, which will
have a number
real.
d. Prompt the user for the radius and then the height of a cylinder
in real numbers.
and. Ask the user for the volume of liquid to be stored in the
cylinder.
F. Calculate the volume of the cylinder using the following
equation, where
v = volume of cylinder, r = radius, a = height.
v = Pi * r2 * a
g. Present the cylinder volume to the user.
h. Use the If structure to evaluate the following conditions.
1. If the volume of the liquid is greater than the volume of the
cylinder, present
the message “Liquid will overflow”.
2. Otherwise, if the volume of the liquid is less than half of
the
cylinder volume, display the message “You can add twice as
much
liquid volume ”.
3. Otherwise, display the message “There will be no overflow
liquid".
Hi,
Hope you are doing fine. I have dessigned the flowchart of the above question using flowgorithm. All the requirements have been kept in mind and relevant comments are provided (Text in dotted boxes) which give the explanation of the problem. However, there is one thing which I would like to calrify regarding the above question. It is about the constant 'Pi'. In flowgorithm, we cannot declare Pi as a constant because it is already predfined with an appropriate value in the software. Redclaring it would cause errors. 'Pi' can be used directly in flowgorithm without declaration as it is predefined constant.
Flowchart:
Pseudocode:
Function Main
... declaring volume
Declare Real v
... declaring radius of cylinder
Declare Real r
... declaring the height of cylinder
Declare Real a
... declaring the volume of liquid to be storeed in cylinder
Declare Real liquid
... Prompting user to give inputs of r,a and liquid one after the
other
Output "Enter the radius of the cylinder: "
Input r
Output "Enter the height of the cylinder: "
Input a
Output "Enter the volume of liquid to be stored in the cylinder:
"
Input liquid
... Calculating volume of cylinder. Note that Pi has never been
declared in the prograam. This is because Pi is a predefined
constant in flowgorithm and declaring a variable with same name
will produce an error.
Assign v = Pi * r*r*a
Output "Volume of cylinder is: "&v
... checking if volume oof liquid is greater than volume of
cyinder
If liquid>v
Output "Liquid will overflow"
False:
... checking if volume of liquuid is less than twice of volume of
cylinder
If liquid < 2*v
Output "You can add twice as much liquid volume"
False:
Output "There will be no overflow liquid"
End
End
End
Output: