forked from abhaysamantni/Python_OOP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircle.py
More file actions
33 lines (22 loc) · 767 Bytes
/
circle.py
File metadata and controls
33 lines (22 loc) · 767 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
31
# The circle defines a class that perform
# calculations related to circles.
import math
class Circle:
def __init__(self):
self.radius = 1.0
self.__scalingFactor = float(1.0)
def calculate_area(self):
return self.__scalingFactor * math.pi * self.radius**2
#return math.pi * self.radius**2
def resize_circle(self, new_radius):
self.radius=new_radius
def calculate_circumference(self):
return 2*math.pi*self.radius
def set_radius(self,r):
self.radius=r
def get_radius(self):
return self.radius
def set_scalingFactor(self, k):
self.__scalingFactor=k
def get_scalingFactor(self):
return self.__scalingFactor