CS 4773 Object Oriented Programming, Spring 1997
Assignment 2
Due Thursday, February 6
Assignment 2 has 4 parts. The first 3 parts are very short.
Part 1:
- Make a directory for holding your java programs.
- Set your CLASSPATH variable to include this path.
- Make a directory with the sane name as your username under
this directory. The rest of this assignment assumes that your
username is xyzw.
- Make a directory called assign2 under xyzw and
copy java_test.java into this directory.
- Change the name of this file to simple.java.
- Modify the source so that references to java_test
are replaced by references to simple.
- Create a makefile for making and running this program.
- Test this to make sure it runs correctly.
Part 2:
- Copy simple.java to simple1.java
and change references to simple to simple1.
- Add a package line to this program. Call the
package xyzw.assign2.
- Modify the HTML at the top of the program to refer to this package.
- Add lines to the makefile to compile and run this program.
- Test this to make sure it runs correctly.
Part 3:
- Copy simple1.java to simple2.java
and change references to simple1 in this file to simple2.
- Add lines to the makefile to compile and run this program.
- Modify the clear_it function so that it draws a second
string, this one having the form:
This program was written by ...
- Test this.
Part 4:
- Copy simple2.java to dragit.java
and change references to simple2 in this file to dragit.
- Add lines to the makefile to compile and run this program.
- Modify the program so that it behaves as follows:
- When it starts, a single oval is drawn of the same size as before.
- If the mouse is pushed and it is not pointing inside the bounding
rectangle of the oval, the status line displays the message:
You missed it!
- If the mouse is pushed and it is pointing inside the bounding
rectangle of the oval, the status line displays the message:
You got it!
Dragging the mouse will drag the oval. When the mouse is
released, the status line will disappear and the oval will stay
in its new position until the
mouse is pushed again over its new position.
- When the mouse is clicked, released, or dragged there should
not be any flicker or jerky motion of the oval.
- The clear button should move the oval to the initial position.
Before the due date, insert a link in your course home page to the
the highest numbered part of this assignment that you want me to test
and install your class file and an appropriate HTML file under your
public_html directory. The html file which points to your java
class file should reference the package xyzw.assign2.
The class file should be in a subdirectory xyzw/assign2
of the directory containing this html file. Your source code should not be in
public_html. Hand in copies of your source code for all parts
attempted. Print these out two per page.
Also include a printout of your makefile.
Use the burst page from one of your printouts as a cover page.
On this cover page state clearly exactly what worked and what did not.