Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create the program in Python 3.9 please. Objectives: Practice implementing loops Practice writing conditions Practice implementing functions Assignment: For this lab assignment, we're going to
Create the program in Python 3.9 please.
Objectives: Practice implementing loops Practice writing conditions Practice implementing functions Assignment: 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 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) 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) Return values: none 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 workStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started