Question: PLEASE FORMAT INPUT/OUTPUT LIKE SHOWN BELOW, ALSO PLEASE USE PYTHON For this lab assignment, we're going to be dealing with rectangles and an independent point.


PLEASE FORMAT INPUT/OUTPUT LIKE SHOWN BELOW, ALSO PLEASE USE PYTHON

For this lab assignment, we're going to be dealing with rectangles and an independent point. How we're going to determine where/how big your rectangle is located is through the x, y-coordinates of the lower left corner and upper right corner. So, like the following: (x1, y2) (x2, y2) (x1, y1) (x2, y1) We're testing your coordinate point (another independent x, y-coordinate pair) to see whether the point is inside the rectangle, outside the rectangle, or intersecting one of the lines of the rectangle. If the point is outside of the rectangle, we're then going to determine whether the point is north, south, east, west, or any combination (southeast, southwest, etc) in relation to the rectangle. The program should get the coordinates for the rectangle once. However, the user should be able to enter in however many points to test that they'd like. Note: North, south, east, and west should be inclusive on the respective axis. So, for instance, if the point is north of the rectangle, but the x-coordinate lies on the eastern border of the rectangle (so the point shares an x coordinate with the rectangle), then the point would be north, not northeast Specifications: Your program should achieve the assignment using three functions, defined as follows: main O Parameters: none o Return values: none o Purpose: Gets input from the user Loops for points until the user no longer would like to (can assume the user enters correct input) Calls functions Only calls cardinalLocation is the point is outside the rectangle pointLocation o Parameters: rectangle coordinates, point coordinates (should have six total) o Return values: boolean indication of inside/outside rectangle o Purpose: Determines whether the point is inside, outside, or intersecting the rectangle Informs the user of such (output inside function) Returns True for outside, False for anything else cardinalLocation o Parameters: rectangle coordinates, point coordinates (should have six total) o Return values: none o Purpose: Only ran if point was outside rectangle Determines whether point is north, south, east, west, northeast, northwest, southeast, or southwest of the rectangle Informs the user of such (output inside function) Hints: A lot of this program is just copying/pasting a lot of conditions (there's a lot). Make sure you utilize compound conditions -- you don't have to use nested conditions here (as in, it's not required). Work on this in parts -- it's not difficult work (once you have the correct conditions), just a lot of meticulous work. Sample Execution 1: Welcome to the point/rectangle calculator! First, we'll get the coordinates for your rectangle! Enter in the x-coordinate for the lower left corner: 0 Enter in the y-coordinate for the lower left corner: 0 Enter in the x-coordinate for the upper right corner: 100 Enter in the y-coordinate for the upper right corner: 100 Now, we'll get the coordinates for the point you're testing. Enter in your x-coordinate: 34 Enter in your y-coordinate: 104 Your point is outside the rectangle. Your point is north of the rectangle. Would you like to test more rectangles/points? (yeso) yes Now, we'll get the coordinates for the point you're testing. Enter in your x-coordinate: 8 Enter in your y-coordinate: 0 Your point intersects the rectangle. Would you like to test more rectangles/points? (yeso) no Good-bye
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
