100%(3)3 out of 3 people found this document helpful
This preview shows page 1 - 3 out of 7 pages.
A Winter WonderlandIn this lab, we'll use OOP for graphics programming and add some interactivity to the application.Your ClassesThe Drawable ClassIn this week's lecture we discussed how we can used object oriented programming concepts to make graphics applications more organized and easier to create. One of the things that we'll leverage is inheritance, polymorphism, and abstract base classes.We have included drawable.pythat contains an abstract base class called (shocker) DrawableThis class has the following methods:A constructor (__init__) method where you can set the xand ylocations for your object.Accessor and mutator methods for the x and y locations.An abstractmethod called drawthat takes a surface to draw on as a parameter.Rectangle classNow we're going to derive from this class. The first derived class you'll want to make is RectangleTo instantiate the Rectangleclass you need:The (x,y) location where the Rectangleis to be drawnIt's width and heightIt's colorThen in the class's draw method you draw a rectangle starting at (x,y) of dimensions (width, height) on the surface in the chosen color.NOTE: For credit you must derive from Drawableand use it's constructor.The Snowflake ClassNext up let's create a Snowflake!
A Snowflake will be made up of 4 lines. If the Snowflake is to be centered at (x,y) then those four lines are