psuedocode with comments needed (python) and the output! again provide the psued
ID: 3700058 • Letter: P
Question
psuedocode with comments needed (python) and the output!
again provide the psuedocode in python with comments as well as the ouput!
In this assignment, you will be designing a solid geometric calculator for different shapes. The shapes you need to consider are: cylinder, cube and sphere. Details are below: Lab Procedure: Step 1: You need to define the maximum number of user- defined functions for each of the following shapes * Cylinder Formulas (r- radius and h height): . Calculate volume of a cylinder: V Ttr2h · Calculate the lateral surface area of a cylinder: L = 2trh . Calculate the top and bottom surface area of a cylinder: T B Ttr2 · Total surface area of a closed cylinder is: A = L + T + B = 2trh + 2(nr) = 2tr(h+r) Formulas for a cube (a -side length): Volume of a cube: V- a . Surface area of a cube: S 6a . Face diagonal of a cube: f- av2 Sphere Formulas (r- radius): Volume of a sphere: V- (4/3)rr3 Circumference of a sphere: C = 2tr surface area of a sphere: A = 4tr · » Step 2: Create a utility module to define all your user-defined functions for shape calculations. Create a main application module that allows a user to perform the required calculations according to the choice. The application should provide a menu, should use appropriate screen- clearings to assist the user in focusing on the output, and should make maximal use of user- defined functions. The naming convention of the utility and application module will be as follows: o Utility module: firstname_lastname_BWA4 utility.py o Main module: firstname_lastname_BWA4_ application.py * Step 3: All the functions should be well documented with docstring and appropriate naming conventions. The docstring should contain the following information o Function description o Parameter/Input: datatype o Return/output: datatypeExplanation / Answer
Screenshot
Program
utility.py
#Functions in firstname_lastname_BWA4_utility
def cylinder_volume(radius,height):#cylinder Volume calculation
pi=3.14
V=pi*pow(radius,2)*height;
return V
#cylinder lateral surface area
def cylinder_lateral_surface_area(radius,height):
pi=3.14
L=2*pi*radius*height
return L
#cylinder top=bottom surface area
def cylinder_topbottom_surface_area(radius):
pi=3.14
T=pi*pow(radius,2)
return T
#cylinder total surface area
def cylinder_total_surface_area(radius,height):
pi=3.14
A=2*pi*radius*(height+radius)
return A
#Cube volume
def cube_volume(a):
V=pow(a,3)
return V
#cube surface area
def cube_surface_area(a):
S=6*pow(a,2)
return S
# cube face diagonal calculation
def cube_face_diagonal(a):
f=a*(2(**.5))
return f
#Shere volume
def sphere_volume(r):
V=(4/3)*3.14*pow(r,3)
return V
#Shere circuference
def sphere_circumference(r):
C=2*3.14*r
return C
#sphere surface area
def sphere_surface_area(r):
A=4*3.14*pow(r,2)
return A
#menu print function
def print_menu(): ## Your menu design here
print (30 * "-" , "MENU" , 30 * "-")
print ("0. Press 0 for Cyllinder Volume")
print ("1. Press 1 for Cyllinder Lateral Surface Area")
print ("2. Press 2 for Cyllinder Top Bottom Surface Area")
print ("3. Press 3 for Cyllinder Total Surface Area")
print ("4. Press 4 for Cube Volume")
print ("5. Press 5 for Cube Surface Area")
print ("6. Press 6 for Face Diagonal")
print ("7. Press 7 for Shere Volume")
print ("8. Press 8 for Shere CircuFerences")
print ("9. Press 9 for Shere Surface Area")
print ("10. Press 10 for Exit")
print (67 * "-")
Main.py
from firstname_lastname_BWA4_utility import *
def main():
loop=True
while loop: ## While loop which will keep going until loop = False
print_menu() ## Displays menu
choice = int(input("Enter your choice [0-9]: "))
if choice==0:
h=int(input("Please enter the height of the cylinder:"))
r=int(input("Please enter the radius of the cylinder:"))
print("Cylinder Volume =%.2f"%(cylinder_volume(r,h)))
elif choice==1:
h=int(input("Please enter the height of the cylinder:"))
r=int(input("Please enter the radius of the cylinder:"))
print("Cylinder Lateral Surface Area =%.2f"%(cylinder_lateral_surface_area(r,h)))
elif choice==2:
r=int(input("Please enter the radius of the cylinder:"))
print("Cylinder Top Bottom Surface Area =%.2f"%(cylinder_topbottom_surface_area(r)))
elif choice==3:
h=int(input("Please enter the height of the cylinder:"))
r=int(input("Please enter the radius of the cylinder:"))
print("Cylinder Total Surface area =%.2f"%(cylinder_total_surface_area(r,h)))
elif choice==4:
a=int(input("Please enter the side of the Cube:"))
print("Cube Volume =%.2f"%(cube_volume(a)))
elif choice==5:
a=int(input("Please enter the side of the Cube:"))
print("Cube Surface areae =%.2f"%(cube_surface_area(a)))
elif choice==6:
a=int(input("Please enter the side of the Cube:"))
print("Cube Face Diagonal =%.2f"%(cube_face_diagonal(a)))
elif choice==7:
r=int(input("Please enter the radius of the Sphere:"))
print("Sphere Volume =%.2f"%(sphere_volume(r)))
elif choice==8:
r=int(input("Please enter the radius of the Sphere:"))
print("Sphere CircumFerence =%.2f"%(sphere_circumference(r)))
elif choice==9:
r=int(input("Please enter the radius of the Sphere:"))
print("Sphere Surface Area =%.2f"%(sphere_surface_area(r)))
elif choice==10:
loop=False # This will make the while loop to end as not value of loop is set to False
else:
# Any integer inputs other than values 1-5 we print an error message
input("Wrong option selection. Enter any key to try again..")
if __name__ == "__main__":
# execute only if run as a script
main()
--------------------------------------------------------------------------------------------------
Pseudocode
while true:
print menu
choice=input "0-10 choices to find solid shape calculator:
if choice=0
x=input "enter height"
y=input "enter radius"
call cylinder_volume function
print result
else if choice=1
x=input "enter height"
y=input "enter radius"
call cylinder_lateral_surface_area function
print result
else if choice=2
y=input "enter radius"
call cylinder_topbottom_surface_area function
print result
elsif choice=3
x=input "enter height"
y=input "enter radius"
call cylinder_total_surface_area function
print result
else if choice=4
a=input "enter side of the cube"
call cube_volume function
print result
else if choice=5
a=input "enter side of the cube"
call cube_surface_area function
print result
else if choice=6
a=input "enter side of the cube"
call cube_face_diagonal function
print result
else if choice=7
x=input "enter radius of sphere"
call shere_volume function
print result
else if choice=8
x=input "enter radius of sphere"
call shere_circumference function
print result
else if choice=9
x=input "enter radius of sphere"
call shere_surface_area function
print result
else if choice=10
while loop reset
else
while loop again
code repeat until 10 enter.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.