Question: 4.12 Rectangles (homework 2) Write a program called rectangles.py that prompts the user for the upper-left coordinates, widths and heights of two rectangles, and draws

 4.12 Rectangles (homework 2) Write a program called rectangles.py that prompts

4.12 Rectangles (homework 2) Write a program called rectangles.py that prompts the user for the upper-left coordinates, widths and heights of two rectangles, and draws them using the GuiZero Drawing canvas. Further, your program should determine if one of the rectangles is inside the other, or if one overlaps with the other, and write an appropriate description on the canvas and print it on the console. Handle cases in which the rectangles are disjoint, overlap, where rectangle 1 contains rectangle 2, or where rectangle 2 contains rectangle 1. For example, see the outputs of three sample runs of the program shown here. The rectangles overlap. The rectangles are disjoint. Rectangle 1 contains rectangle 2. Here's a sample run that shows the relevant input and prompts for the first example shown above. Enter rectangle 1 x: 120 Enter rectangle 1 y: 1202 Enter rectangle 1 width: 1004 Enter rectangle 1 height: 1002 Enter rectangle 2 x: 110 Enter rectangle 2 y: 110 Enter rectangle 2 width: 504

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