Question: roblem: Troblem: The Circle Design a class which represents a Circle in the ( x , y ) coordinate plane. A Circle object is initialized

roblem: Troblem: The Circle
Design a class which represents a Circle in the (x,y) coordinate plane. A Circle object is initialized with
three input arguments. The center of the circle specified as the first two inputs (x,y) and the radius of
the circle. By default, the circle will be centered at (0,0) with a radius of 1(that would be implemented
in the constructor). The constructor should be consistent with the following logic:
c = Circle(0,0,1) # circle centered at (0,0) with r=1
c = Circle(1) # circle centered at (1,0) with r=1
c = Circle(1,1) # circle centered at (1,1) with r=1
c = Circle() # circle centered at (0,0) with r=1
A negative radius input should raise a ValueError with a proper message.
Action Methods
The Circle class should provide proper getters/setters for the x and y coordinates of the center as well as
the radius (getRadius, getX, getY, setRadius, setX, setY).
Action Methods
The Circle class should implement the following member functions:
def calcArea(): return the area of the circle as float
def calcPerimeter(): return the perimeter of the circle as float
def isPointWithinCircle(x,y): returns True/False
Overloading Methods
def __eq__(self, other) returns True if the circles have same x, y, r
def __ne__(self, other)
Stream I/O
The class must print out the following representation of itself when passed to the print
function: (x, y, r). For example, if c1= Circle(), then print(c1) would print the string
(0,0,1)(without the double quotes).he Circle
Design a class which represents a Circle in the (x,y) coordinate plane. A Circle object is initialized with
three input arguments. The center of the circle specified as the first two inputs (x,y) and the radius of
the circle. By default, the circle will be centered at (0,0) with a radius of 1(that would be implemented
in the constructor). The constructor should be consistent with the following logic:
c = Circle(0,0,1) # circle centered at (0,0) with r=1
c = Circle(1) # circle centered at (1,0) with r=1
c = Circle(1,1) # circle centered at (1,1) with r=1
c = Circle() # circle centered at (0,0) with r=1
A negative radius input should raise a ValueError with a proper message.
Action Methods
The Circle class should provide proper getters/setters for the x and y coordinates of the center as well as
the radius (getRadius, getX, getY, setRadius, setX, setY).
Action Methods
The Circle class should implement the following member functions:
def calcArea(): return the area of the circle as float
def calcPerimeter(): return the perimeter of the circle as float
def isPointWithinCircle(x,y): returns True/False
Overloading Methods
def __eq__(self, other) returns True if the circles have same x, y, r
def __ne__(self, other)
Stream I/O
The class must print out the following representation of itself when passed to the print
function: (x, y, r). For example, if c1= Circle(), then print(c1) would print the string
(0,0,1)(without the double quotes).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!