Python Programming: An Introduction to Computer Science

(Nora) #1
84 CHAPTER5. OBJECTSANDGRAPHICS


  1. 5-clickhouse.
    Youaretowritea programthatallowstheusertodraw a simplehouseusingfive mouse-clicks.The
    firsttwo clickswillbetheoppositecornersoftherectangularframeofthehouse.Thethirdclickwill
    indicatethecenterofthetopedgeofa rectangulardoor. Thedoorshouldhave a totalwidththatis^15
    ofthewidthofthehouseframe.Thesidesofthedoorshouldextendfromthecornersofthetopdown
    tothebottomoftheframe.Thefourthclickwillindicatethecenterofa squarewindow. Thewindow
    is halfaswideasthedoor. Thelastclickwillindicatethepeakoftheroof.Theedgesoftheroofwill
    extendfromthepointat thepeaktothecornersofthetopedgeofthehouseframe.


1


2


(^34)


5

Free download pdf