Software Engineering - CMSC 435
Fall 1998
Prof. Ben Bederson
Homework #1
Due Tue, Sept. 15th
This assignment is to get you familiar with objects in Java. You must write a Java drawing applet. It must give the user the ability to draw free-hand squiggles, straight lines, rectangles, and ovals. However, this time, each graphic must be represented by an underlying object. You must add the functionality to select, move, and delete individual objects. You must implement selection by supporting the ability to pick an object by clicking anywhere in the object’s bounding box.
To implement this project, you should define a base class that represents a graphic, and then define sub-types for each of the four graphic types. Each graphic must maintain its bounding box, and you must keep a data structure that stores your objects so you can go through them in back to front order (for rendering) and front to back order (for picking).
You should define the paint() method to render the list of objects. This way, whenever AWT determines that the window needs to be redrawn, your paint method will be called which will draw all of the objects. You can then just call the update() method in your event handlers whenever you change the scene. The update() method clears the widget, and then calls the paint method.
You must document your code using javadoc. Javadoc is a program that comes with the jdk that allows you to write comments in your code that javadoc will then use to generate documentation. This is a nice way of keeping the documentation near your code, and generating nice web pages describing it at the same time. You should submit your javadoc documentation with your homework in a sub-directory with your submission called "doc".
Even though we have not talked about many details of Software Engineering, use your best programming style. This includes proper variable naming, documentation and programming structure. We will look at students’ code and analyze the different approaches that people used.
You must turn in your project in the following way.
If it is not turned in before the start of class, it will be considered late. On the course home page, we will make links to all of your applets so you can see what your fellow-students created.