diff --git a/python/Circle.py b/python/Circle.py new file mode 100644 index 0000000..de3c245 --- /dev/null +++ b/python/Circle.py @@ -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)) diff --git a/python/Figure.py b/python/Figure.py new file mode 100644 index 0000000..009309f --- /dev/null +++ b/python/Figure.py @@ -0,0 +1,4 @@ +class Figure: + + def area(self): + print("Not implemented") \ No newline at end of file diff --git a/python/Rectangle.py b/python/Rectangle.py new file mode 100644 index 0000000..7815e5f --- /dev/null +++ b/python/Rectangle.py @@ -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)) diff --git a/python/Square.py b/python/Square.py new file mode 100644 index 0000000..e4564b3 --- /dev/null +++ b/python/Square.py @@ -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)) diff --git a/python/main.py b/python/main.py new file mode 100644 index 0000000..14698d6 --- /dev/null +++ b/python/main.py @@ -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')