Warmup Programming Assignment

Due: Sept. 21, 1998


The purpose of this assignment is to make sure everyone has a working Java setup, and can start writing a simple program.

Write an applet that takes as input a number of kilometers and reports back the number of equivalent miles. As an applet, there will be a small window with fields where the user can enter the input, and where output is displayed. Thus, you will need an input and output textfield be built in the initialization procedure, (called when your program starts up), and an event handler, called action listener.

The initialization routine looks something like:

The action listener notices when the user has typed input in the textfield, and extracts the input, notifies the applet, and redraws the screen as follows:

Remember that to view the applet you need an html file, call it

Convert.html, that looks like the following,

which you can view with a browser or an appletviewer:

Then type appletviewer Convert.html to start it going.