Topics: Object Oriented Programming: data abstraction, class def, class instances, methods
Lecture Notes
Readings
Ch 10.1
Finger Exercise Lecture 17
Write the class according to the specifications below:
class Circle():
def __init__(self, radius):
""" Initializes self with radius """
# your code here
def get_radius(self):
""" Returns the radius of self """
# your code here
def set_radius(self, radius):
""" radius is a number
Changes the radius of self to radius """
# your code here
def get_area(self):
""" Returns the area of self using pi = 3.14 """
# your code here
def equal(self, c):
""" c is a Circle object
Returns True if self and c have the same radius value """
# your code here
def bigger(self, c):
""" c is a Circle object
Returns self or c, the Circle object with the bigger radius """
# your code here