Question: Question 3 using python jupyter The figure below shows a tank made of: A conical part (reversed cone) with base radius=R and height=R A cylinder
Question 3
using python jupyter
The figure below shows a tank made of:
A conical part (reversed cone) with base radius=R and height=R
A cylinder with height=2R and base radius=R.
If the liquid level is quite low, in the conical part, the volume is simply the conical volume of liquid. In this case the radius of the filled part of the cone is simply equal to d.
If the liquid level is somewhere in the cylindrical part, the total volume of liquid includes the filled conical part and the partially filled cylindrical part.
Write a program that prompts for and reads:
the values of d (liquid level) and R (cylinder radius).
It then computes and displays the volume of the liquid in the tank.
Note that the value of d is between 0 and 3R. R has to be positive.
If d exceeds 3R, your program displays Tank overfilled message and stops.
If d <=0 or R <=0, it displays Wrong input message,as shown below, and stops.
If d is between 0 and R, then the filled part is a reversed cone with base radius = d. =2 where h=filled height of cylinder =132
Sample run 1 Enter radius of the cylinder: -4.5 Radius must be positive
Sample run 2 Enter radius of the cylinder: 2.5 Enter liquid level : -6.5 Liquid level must be positive
Sample run 3 Enter radius of the cylinder: 3.5 Enter liquid level : 16.5 Tank is overfilled
Sample run 4 This for liquid level in cone only Enter radius of the cylinder: 12.5 Enter liquid level : 8.5 Total volume of liquid = 643.11
Sample run 5 This for liquid level somewhere in cylinder Enter radius of the cylinder: 12.5 Enter liquid level : 28.6 Total volume of liquid = 9948.38
In [ ]:
#%%writefile HW1Q3.py
# Your code for Question 3 in this cell
# After you finish writing your code and check that it is working correctly,
# uncomment the first line and run your code so that it genrates HW1Q3.py file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
