Halloween objects

The plan

Today we continue working on the pumpkin and the next homework before turning our attention to searching, sorting and algorithm analysis next week.

Populating the project

There is a lot of Java to get ready.

In new browswer tabs, open up the following web pages.

Now start up a new NetBeans project and add the following three classes.

Now add two more files.

Implementing the interface

Make the Pumpkin and RotatedRectangle classes implement the ProcessingDrawable2D interface. For the Pumpkin class this should be nothing more than adding implements ProcessingDrawable2D to the class header. For the RotatedRectangle you will need to implement the draw method. For starters, you may want to draw the rectangle without rotation. Later you might consider using the beginShape() method of the PApplet with the iterator in the RotatedRectangle.

Doing something in the sketch

Homework 10 has some very specific requirements. Get started by creating one RotatedRectangle and one Pumpkin object in the startup method. Use the mutator methods to initialize the fields of these objects. Create an ArrayList<ProcessingDrawable2D> in startup and place these two objects in it.

In the draw method of the sketch, draw both of these objects.