# Gt Gt Gt R1 R1 Rectangle Point Point 1 1 Red Rectangle Point 0 0 Point 1 1 Red G

Please see the attached pictures. add 2 classes to the point class.

Class Rectangle represents a 2D (axis-parallel) rectangle that a user can draw on a computer screen. Think of a computer screen as a plane where each position has an x and a y coordinate. The data (i.e. atrributes) that each object of type Rectangle should have (and that should be initialized in the constructor, i.e., __init__ method of the class Rectangle) are: * two Points: the first point representing the bottom left corner of the rectangle and the second representing the top right corner of the rectangle; and, * the colour of the rectangle Note that the two points (bottom left and top right) completely determine (the axis parallel) rectangle and its position in the plane. There is no default rectangle. (see drawings_part2.pdf file for some helpful illustrations) The __init__ method of Rectangle (that is called by the constructor Rectangle) will take two objects of type Point as input and a string for the color). You may assume that the first Point (passed to the constructor, i.e. __init__) will always have smaller than or equal x coordinate than the x coordinate of the second Point and smaller than or equal y coordinate than the y coordinate of the second Point. Class Rectangle should have 13 methods. In particular, in addition to the constructor (i.e. __init__ method) and three methods that override python’s object methods (and make your class user friendly as suggested by the test cases), your class should contain the following 9 methods: get_bottom_left, get_top_right, get_color, reset_color, get_perimeter, get_area, move, intersects, and contains. Here is a description of three of those methods whose job may not be obvious from the test cases. * Method move: given numbers dx and dy this method moves the calling rectangle by dx in the x direction and by dy in the y-direction. This method should not change directly the coordinates of the two corners of the calling rectangle, but must instead call move method from the Point class. * Method intersects: returns True if the calling rectangle intersects the given rectangle and False otherwise. Definition: two rectangles intersect if they have at least one point in common, otherwise they do not intersect. * Method contains: given an x and a y coordinate of a point, this method tests if that point is inside of the calling rectangle. If yes it returns True and otherwise False. (A point on the boundary of the rectangle is considered to be inside).

Class Canvas represents a collection of Rectangles. It has 8 methods. In addition, to the constructor (i.e. __init__ method) and two methods that override python’s object methods (and make your class user friendly as suggested by the test cases), your class should contain 5 more methods: add_one_rectangle, count_same_color, total_perimeter, min_enclosing_rectangle, and common_point. Here is a description of those methods whose job may not be obvious from the test cases. * The method total_perimeter: returns the sum of the perimeters of all the rectangles in the calling canvas. To compute total perimeter do not compute a perimeter of an individual rectangle in the body of total_perimeter method. Instead use get_perimeter method from the Rectangle class. * Method min_enclosing_rectangle: calculates the minimum enclosing rectangle that contains all the rectangles in the calling canvas. It returns an object of type Rectangle of any colour you prefer. To find minimum enclosing rectangle you will need to find the minimum x coordinate of all rectangles, the maximum x coordinate for all rectangles, the minimum y coordinate and the maximum y coordinate of all rectangles. * Method common_point: returns True if there exists a point that intersects all rectangles in the calling canvas. To test this (for axis parallel rectangles like ours), it is enough to test if every pair of rectangles intersects (according to a Helly’s theorem for axis-alligned rectangles: http://en.wikipedia.org/wiki/Helly’s_theorem ). *** Finally recall, from the beginning of the description of this assignment that each of your methods should have a type contract.

• Attachment 1
• Attachment 2
• Attachment 3
• Attachment 4
• Attachment 5

&gt; &gt; &gt; r1r1=Rectangle(Point( ), Point( 1,1), &quot;red&quot; )Rectangle(Point (0,0), Point(1,1), ‘red’ )&gt;&gt;&gt; rl.get_color( )’red’&gt; &gt; &gt; r1.get_bottom_left( )Point(0,0)&gt;&gt;&gt; rl.get_top_right( )Point(1, 1)&gt; &gt; &gt; r1. reset_color( &quot;blue&quot; )&gt; &gt; &gt;’bluerl.get_color( )&gt; &gt;&gt; r1Rectangle(Point (0, 0), Point(1, 1), ‘blue’ )&gt; &gt; &gt; r1. move( 2, 3)&gt; &gt; &gt;r1Rectangle(Point (2, 3), Point(3,4), ‘blue ‘ )&gt; &gt; &gt;&gt; &gt; &gt; print(r1)I am a blue rectangle with bottom left corner at (2, 3) and top right corner at (2, 3) .&gt; &gt; &gt;&gt; &gt; &gt; r&gt; &gt; &gt; r2r2=eval(repr(r1) )&gt; &gt; &gt;Rectangle(Point (2, 3) , Point(3,4), ‘blue’ )&gt; &gt; &gt; r1 is r2False&gt; &gt; &gt; r1==r2True&gt; &gt; &gt; r3=Rectangle(Point( ), Point(2, 1), &quot;red&quot;)&gt; &gt; &gt; r3 . get_perimeter ( )r4=Rectangle(Point(1, 1), Point(2, 2.5), &quot;blue&quot; )&gt; &gt;&gt; r4.get_area ( )1.5&gt; &gt; &gt; r5=Rectangle(Point (1, 1), Point(2, 2.5), &quot;blue&quot;)&gt; &gt; &gt; r4 == r5True&gt; &gt; &gt; r4 is r5False&gt; &gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt; 1r=Rectangle(Point(1,1), Point(2,5), &quot;blue&quot; )&gt; &gt; &gt; r. contains(1.5,1)True&gt; &gt; &gt; r. contains(2, 2)True&gt; &gt; &gt;r. contains(0, 0)&gt; &gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;&gt; &gt; &gt;===== RESTART ===&gt; &gt; &gt;&gt; &gt; &gt;&gt;&gt; &gt; r1=Rectangle(Point (1, 1), Point(2, 2), &quot;blue&quot; )r2=Rectangle(Point (2, 2.5), Point(3, 3),&gt; &gt; &gt; r3=Rectangle(Point(1. 5, 0), Point(1.7, 3) , &quot;red&quot; ), &quot;blue&quot; )&gt; &gt; &gt;&gt; &gt; &gt; print(r3)