Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

6. The water tower shown is comprised of a cylindrical lower portion, and a sphe

ID: 3900635 • Letter: 6

Question

6. The water tower shown is comprised of a cylindrical lower portion, and a spherical upper portion. The dimensions of each portion are shown in the diagram. Inside the tank is a float that indicates the level of water (denoted by height, h.) Ask the user to enter the water height, h, and use this information to calculate the total volume of water in the tower. diamater diameler 20m You can easily look up the Volume of a cylinder, but here is how to calculate the volume of a portion of a sphere (a "spherical cap"): Where: hd depth of water in the sphere

Explanation / Answer

Hello student!

Here goes the matlab code.

%% starts here

pi = 3.1416;

diameterCyl = 20;

hCyl = 15;

dSph = 25;

hd = input('Enter height of the water');

R = dSph/2; % (Radius of sphere);

r = sqrt(2*R*hd - hd*hd); % radius of the water line.

V = hd*pi*(3*r*r + hd*hd)/6;

fprintf('The volume of the figure will be : %d', V);

%% ends here

Test case / Output :

Enter height of the water 5
The volume of the figure will be : 8.508500e+02

Thank you.

Feel free to ask anything