Source Code Structure
Step One: Important!
To start with this lab, download the project as a zip file from here : Lab 8.Now you may simply import the zip file as an entire project into Eclipse by going to:
File->Import->General->Existing Projects into Workspace
click "Next"
![](images/import.png)
Then "Select Archive File" and Browse to and select the Lab8.zip file you've just downloaded, then hit finished
![](images/import2.png)
Shape Package and Classes
Now that we have our project set up, we will create an additional package for our shapes-- call this package shapes.The shapes package will contain the following files:
- Shape.java:
- Represents any shape that can be drawn.
- We will declare an array of Shape objects in the ShapeDriver class, and initialize each element with a different subclass (Rectangle or Circle).
- Shape has a single abstract method draw().
- Drawing all the Shapes in our window means calling draw() on each Shape.
- This class needs to be declared abstract.
- Rectangle.java:
- Inherits from Shape.
- Overrides the draw() method with a rectangle definition.
- Circle.java:
- Inherits from Shape.
- Overrides the draw() method with a circle definition.
Import Processing Library
Shape.java, Rectangle.java and Circle.java must all import the java processing library:import processing.core.*;