CS 290 – Object-Oriented Programming Due: Friday. Feb 12, 2016

advertisement
CS 290 – Object-Oriented Programming
Homework 3 - XBox - (20 points)
Due: Friday. Feb 12, 2016
This project involves extending the HotDraw program by adding a new type
of figure which consists of a rectangle with lines connecting opposite corners. If
you write more than 100 lines of code, you are doing it the wrong way. If you
write more than 20 lines of code, you aren’t doing it the best way.
You don’t know anything about HotDraw and so much of this assignment is
going to be learning how to add things to it. One of the most valuable techniques
in computer programming is the ability to look at preexisting examples, and
modify them for your own use. Here are the tips for this assignment.
1. Make sure that you can run the application. When you first select Run...
to create a configuration, have it search for the main class. From the
resulting list, you want to select,JavaDrawApp.
2. Once you have the app running, you need to figure out how to create a new
type of figure. Here’s a hint...it should be a subclass of AbstractFigure
or one of its subclasses. If you want to see the hierarchy of a particular
class, select it in the editor and press F4 (Show Type Hierarchy). Look at
the provided figure to determine what you need to do to make a working
figure.
3. Now that you have a figure class, you have to have some way of adding it
to a drawing. The type of object that manipulates figures and drawings
is called a Tool. To see how tools are set up, look at the JavaDrawApp
class’s method named createTools.
That should give you enough information. In the real world, it is not uncommon to spend > 50% of your time simply reading code. This assignment
will probably reflect that.
1
Download