CSE 373, Autumn 2004: Assignment 2
Objectives
There are two objectives to this assignment:
help you gain familiarity with the Visual Applet Framework; and
help you gain fluency with Eclipse.
When and How
Turn this assignment electronically by 5:00 PM on Friday, October 15.
This assignment must be done individually (not in partnerships or groups).
If you are not sure what that means, consult the Department
of Computer Science and Engineering
academic misconduct policy
Turn in your files
here.
The Exercises
This assignment is based on
the Handout on
the Visual Stack Applet for CSE 373.
Although this handout presents much of the code for
the applet, some of the code was cut off, and so the
coverage is not complete. The full source code for
the Visual Stack Applet can be found at
this page.
Do the following exercises at the end of the handout.
exercises 1, 2, 3, 4, 5.
Put your answers to 1, 2, and 3 into a plain ASCII text file
named A2PartA.txt and for exercises 4 and 5, turn in a single
program called A2PartB.java that adds both new features to
the Visual Stack Applet.
Also put your applet for exercises 4 and 5 on the web,
using your UW account.
Use the same arrangement of "OBJECT" and "EMBED" HTML tags
as used for the
web page that hosts the Visual Stack Applet.
Simply point your browser to this page and then select the "View Page Source"
option in your browser to see the tags. This tag arrangement will
allow you to receive credit for your assignment whether the graders
use Microsoft Internet Explorer or Mozilla Firefox to test your applet.
It is recommended that you use the same arrangement of files as
used in this example: create a subdirectory of your web directory
to hold the .class files. Put all the .class files for your applet
in there, and have your applet .html page refer to the subdirectory.
If you are not familiar with Unix commands for moving, copying, and
setting permissions on files and directories, then keep your
eyes and ears peeled for some forthcoming guidelines.
Extra Credit
For 5 percent extra credit, add both of the following
features to your program.
The 2-stack feature: Use exercise 8 as a guide here.
Ideally, the commands for exercise 4 will still work,
with the default stack being Stack A. You may then
accept commands not only such as DO +, but also commands such as DO B +, which would do the addition
on Stack B.
The ZOOM and UNZOOM feature: When the ZOOM command is
processed, all the displayed objects should double in size,
and the font size should be doubled, too. The UNZOOM command
will make everything half as wide and half as long, so that
twice as many stack cells will fit on the screen.
Notes
Your calculator operations (in exercise 4) should consist
of +, *, -, and /.
Here / represents integer division. For example 15/4 = 3.
The handout on the Visual Stack Applet is available
here.
Putting Applets on the Web
There are four steps to putting your Java applet on the web.
1. Set up a web publishing account on the UW Students server.
Here are
instructions.
2. Create a folder c373a2 for your Java program in your public_html folder
and create an HTML page a2.html that will contain your applet.
The permissions on this folder should be "x" meaning that
the web server will be allowed to enter it.
3. Put copies of your Java .class files in the folder,
and make sure that the permissions are all set to readable by others.
You should probably use the Secure Shell File transfer program to
do this.
4. Test your applet from a browser to make sure that your web
installation was successful.
(version of 8 Oct. 2004, with minor updates on 11 Oct. S. Tanimoto)