Write a program, that can draw simple geometric objects, and put some of these objects together to draw a picture like the following one:
As you can see: the picture is composed using three different elements:
The minimum requirement for this assignment is to draw an image containing at least a circle, a rectangle, a line. Additionally the drawing must be programmed inside of a pre defined software framework i'll give to you.
I provide a class called 'GraphicsEngine' (a presumptuous name for such a class, i admit). This class does nothing else than
opening a window on the screen, size 500x500, and providing the actual drawing environment, which is a Java.awt.Graphics class.
The graphics class contains an array of GraphicsObjects, also a class provided by me.
GraphicsObjects is an abstract class. It contains an abstract method 'paintComponent(Graphics g)', along with some fields. For each different geometric object you must define your own class, inherited from GraphicsObject, therefore implementing 'paintComponent(Graphics g)'. You will therefore at least define 3 classes, Circle, Rectangle, Line.
To draw the image, simply add appropriate instances of your classes to the GraphicsObject-array in the class GraphicsEngine. In order to do so, GraphicsEngine offers a method 'addGraphicsObject(GraphicsObject go)'. You don't have to do anything inside the class GraphicsEngine or GraphicsObject, in fact you are not allowed. I only gave the source code to you to have a look into it. In real life you wouldn't be given the source, but the class file only.
'The objects can draw themselves' means: they possess a method, called 'paintComponent(Graphics g)', being defined in GraphicsObject. In 'paint' you can do whatever you want, but you have to use the 'Graphics' object g, which will be provided by the class 'GraphicsEngine'.
I will give an additional bonus point for the picture that i like best (yes, this bonus point is my subjective choice ! :-)