Five-click House. You are to write a program that allows the user to draw a simple house

Chapter 4, Problem 11

(choose chapter or problem)

Get Unlimited Answers
QUESTION:

Five-click House.

You are to write a program that allows the user to draw a simple house using five mouse clicks. The first two clicks will be the opposite corners of the rectangular frame of the house. The third click will indicate the center of the top edge of a rectangular door. The door should have a total width that is \(\frac{1}{5}\) of the width of the house frame. The sides of the door should extend from the corners of the top down to the bottom of the frame. The fourth click will indicate the center of a square window. The window is half as wide as the door. The last click will indicate the peak of the roof. The edges of the roof will extend from the point at the peak to the corners of the top edge of the house frame.

Questions & Answers

QUESTION:

Five-click House.

You are to write a program that allows the user to draw a simple house using five mouse clicks. The first two clicks will be the opposite corners of the rectangular frame of the house. The third click will indicate the center of the top edge of a rectangular door. The door should have a total width that is \(\frac{1}{5}\) of the width of the house frame. The sides of the door should extend from the corners of the top down to the bottom of the frame. The fourth click will indicate the center of a square window. The window is half as wide as the door. The last click will indicate the peak of the roof. The edges of the roof will extend from the point at the peak to the corners of the top edge of the house frame.

ANSWER:

Step 1 of 3

The python program is written to implement the following points:

 1. Get the 2 points for drawing the bottom part. Draw the rectangle using the points

 2. Find the house width by floor width and house height.

 3. Door width is set 1/5th of the house width

 4. Get the third point and draw a rectangle with Door width. That is the door.

 5. Get the fourth point and draw a rectangle by setting the point as center. That is the window.

 6. Get the fifth point and draw a polygon including the upper corners of the bottom part and the fifth point. That is the roof.

Add to cart


Study Tools You Might Need

Not The Solution You Need? Search for Your Answer Here:

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back