Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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