forked from fenyx-it-academy/Class6-Python-Module-Week5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path5.2.py
More file actions
30 lines (24 loc) · 995 Bytes
/
Copy path5.2.py
File metadata and controls
30 lines (24 loc) · 995 Bytes
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
class Rectangle:
def __init__(self, length , width):
self.length = length
self.width = width
def Perimeter(self):
return 2*(self.length + self.width)
def Area(self):
return self.length*self.width
def display(self):
print("The length of rectangle is: ", self.length)
print("The width of rectangle is: ", self.width)
print("The perimeter of rectangle is: ", self.Perimeter())
print("The area of rectangle is: ", self.Area())
class Parallelepipede(Rectangle):
def __init__(self, length, width , height):
Rectangle.__init__(self, length, width)
#super().__init__(length, width)
self.height = height
def volume(self):
return self.length*self.width*self.height
myRectangle = Rectangle(7 , 5)
myRectangle.display()
myParallelepipede = Parallelepipede(7 , 5 , 2)
print("the volume of myParallelepipede is: " , myParallelepipede.volume())