Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

=+ Explain collective bargaining processes and objectives.

Answered: 1 week ago

Question

What are the usual steps in an HR arbitration case?

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago