CSCI 201 Spring 2004

Programming Project 3

In this assignment, you will work a program that displays a several clocks, each showing a time for a different time zone identifier (e.g., EST, Europe/London, Europe/Berlin, Asia/Dacca).

Rather than asking you to develop the Clock class on your own, we are giving you an implementation of that class, and a simple driver class called ClockDriver that displays a single clock at a fixed location. Download Clock.java and ClockDriver.java. Compile these programs and execute the ClockDriver applet. ( Remember, when an Applet program is opened in Netbeans for the first time, you must set it's execution property to Applet as discussed in Lab 4, Making Faces.) A single clock will be displayed as shown below.

Your assignment is to modify the Clock and ClockDriver classes so that is displays several clocks, each with a different time zone identifier. The output should be similar to the one shown below.

Examine the Clock class and notice that it displays a clock at a fixed location. The constructor accepts a String representing the time zone identifier. You must modify this constructor to accept additional parameters in order for clocks to be displayed at different locations.

Examine the ClockDriver class and notice that the paint() calls the Clock Constuctor and draw() methods only once. You must modify this code to produce a display of multiple clocks. This class also prints out all the available time zone identifiers.

Of course, you are encouraged to improve on the clock display above. However, there are certain requirements that you must meet:

Here are a couple of hints that may help you get started. After you have completed the Clock class constructor, change the ClockDriver to make use of the new constructor and verify that you can still draw one clock at the same location as before. Then make a loop that draws one row of identical clocks. Note that you will need to use a conditional statement inside of the loop to set a new location and different time zone for each clock (or perhaps call a method that does that job). Finally, make a display of multiple rows of clocks.

Programming Style

Note that 10% of your program grade is based on the readability of your program. This includes things like proper indentation, comments, and the naming of variables and methods as described in the style guide for this class. To receive full credit for your program, make sure that you use proper indentation as demonstrated in your text and in class room examples. Also include comments at the top of each program stating your name, the course, and the purpose of the program: For example:

/*
** Name: your name here
**
** Course: CSCI 201
**
** Purpose: purpose of program here
*/

Submitting Programs

The programs written for this assignment must be turned in by placing it in your csci/201 directory. The programs must have the names Clock.java, ClockDriver.java, and ClockDriver.html and they must be located in the directory csci/201/Clocks. The program will be automatically copied from this location at mid-night on March 24, 2004.