-
Notifications
You must be signed in to change notification settings - Fork 0
/
2lc5.py
35 lines (32 loc) · 973 Bytes
/
2lc5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
class ThreeDshapes:
def Printvolume(self):
pass
def Printarea(self):
pass
class Sphere(ThreeDshapes):
def __init__(self,radius):
self.Radius=radius
def Printarea(self):
area=4*3.14*self.Radius**2
return area
def Printvolume(self):
vol=round(((4/3)*3.14*self.Radius**3),2)
return vol
class Cylinder(ThreeDshapes):
def __init__(self,radius,hight):
self.Radius=radius
self.Hight=hight
def Printarea(self):
area=2*3.14*self.Radius*(self.Radius+self.Hight)
return area
def Printvolume(self):
vol=3.14*self.Hight*(self.Radius**2)
return vol
SP=Sphere(6)
print("===============SPHERE=================")
print("Area :", SP.Printarea())
print("Volume :",SP.Printvolume())
CY=Cylinder(6,10)
print("===============CYLINDER================")
print("Area :", CY.Printarea())
print("Volume :",CY.Printvolume())