[Solved] Rectangle python

30 $

File Name: Rectangle_python.zip
File Size: 150.72 KB

SKU: [Solved] Rectangle python Category: Tag:

Or Upload Your Assignment Here:


Class Rectangle represents a 2D (axis-parallel) rectangle that a user can draw on acomputer screen. Think of a computer screen as a 2D map where each position has an x and ay coordinate.The data that each object of type Rectangle should have (and that should be populated inthe constructor, i.e., __init__ method of the class Rectangle) are:* two Points: the first point representing the bottom left corner of the rectangle and thesecond representing the top right corner of the rectangle; and,* the color of the rectangleNote that the two points (bottom left and top right) completely determine (the axisparallel) rectangle and its position on the map. There is no default rectangle.

The __init__ method of Rectangle (that is invoked by the constructor Rectangle) will taketwo objects of class Point as input and a string for the color). You may assume that thefirst point (sent to the constructor, i.e. __init__) will always have smaller than orequal x coordinate than the x coordinate of the second point and smaller than or equal ycoordinate 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 thefollowing 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 testcases.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Rectangle python
30 $