Goals for this assignment are to:
Carefully read all of Chapter 3 before starting this assignment.
Begin with the Shapes program (zip file) discussed in class. The UML diagram for it can be seen here (pdf).
Run the code first without making any changes. You should see a scene with 2 houses and some grass.
Carefully look through the code to understand it's structure and then make the following additions:
Add an Oval class. Since it will look a lot like the Box class, you may chooseto extend the Box class to create the Oval shape, or not. Test your code.
Extend the PolyShape class to create a FilledPolyShape. Note, to fill a
Polygon object you need to use the command g.fill(p)
instead of g.draw(p)
in the drawShape method.
Test your code.
Add a scale method to the Shape interface. You will then need to make sure that a scale method is available to all of the shapes. Think about how scaling is done before beginning this. Scaling is always relative to a fixed point - where do you want this fixed point to be? What will happen to the composite shape when all of its components are scaled? Will they stay in the correct relative positions?
![]() | Example: the big picture is scaled into a little picture. |
By no later than class on Mon September 24, you should do the following:
By Thursday (Sept 27) you should demonstrate the code to the instructor.
We will look at your pictures in class.