This commit is contained in:
Arkadiusz Hypki 2023-04-04 18:13:18 +02:00
commit 6624cc620d
5 changed files with 55 additions and 0 deletions

11
python/Circle.py Normal file
View File

@ -0,0 +1,11 @@
from Figure import Figure
class Circle(Figure):
_r = None
def setr(self, r):
self._r = r
def area(self):
print("area = " + str(3.14 * self._r**2))

4
python/Figure.py Normal file
View File

@ -0,0 +1,4 @@
class Figure:
def area(self):
print("Not implemented")

13
python/Rectangle.py Normal file
View File

@ -0,0 +1,13 @@
from Figure import Figure
from Square import Square
class Rectangle(Square):
_y = None
def sety(self, y):
self._y = y
def area(self):
print("area = " + str(self._x * self._y))

12
python/Square.py Normal file
View File

@ -0,0 +1,12 @@
from Figure import Figure
class Square(Figure):
_x = None
def setx(self, x):
self._x = x
def area(self):
print("area = " + str(self._x * self._x))

15
python/main.py Normal file
View File

@ -0,0 +1,15 @@
from Circle import Circle
from Figure import Figure
from Rectangle import Rectangle
if __name__ == '__main__':
r = Rectangle()
r.setx(4)
r.sety(8)
r.area()
c = Circle()
c.setr(1)
c.area()
print('Finished')