Question: ( Rectangle Data Type ) Define a data type called Rectangle in rectangle.py that represents a rectangle using 1 D intervals ( ie , Interval

(Rectangle Data Type) Define a data type called Rectangle in rectangle.py that represents a rectangle using 1D intervals (ie, Interval objects) to represent its x (width) and y (height) segments. The data type must support the following API: Instance variables- x-interval of the rectangle, _xint (Interval)- y-interval of the rectangle, _yint (Interval)__init__(self, xint, yint)- Initialize the instance variables to the values of the corresponding parameters area(self)- Return the area of this rectangle perimeter(self)- Return the perimeter of this rectangle contains(self, x, y)- Return True if the rectangle self contains the point (x,y) and False otherwise intersects(self, other)- Return True if the rectangle self intersects the rectangle other and False otherwise __str__(self)- Return a string representation of the rectangle self

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 Programming Questions!