Assignment 2
Dates
- Release Date: September 20th, 1999
- Due Date: October 15th, 1999
Objectives
The purpose of this assignment is:
- To write a first non-trivial Java program.
- To write a program incorporating classes from the Java Abstract Windows Toolkit.
- To write a program incorporating very simple threads.
- To deal with some simple object oriented design issues.
- To write a small documentation tree using javadoc .
Specification
Write a Java application RunStopwatch.java that implements a small
stopwatch. The stopwatch should display minutes, seconds and hundredth seconds.
The stopwatch has an analog and digital display and three
buttons, "Start", "Stop" and "Reset". The functionality of these buttons should be obvious (if it is not clear to you, think about it - what is the most
obvious thing each button should do...). A double buffering mechanism is
applied between updating pictures to prevent flickering. The user is able
to exit from the application by closing (not iconifying) the window. Switching
between analog and digital display is possible even if the stopwatch is running. Resetting the stopwatch is only possible if the stopwatch is stopped.
Here are two sample pictures of the stopwatch.
Stopwatch: Digital Display
Stopwatch: Analog Display
Procedure
Do not start with the entire program - it is probably too difficult.
Try to implement small subsets of the problem, for example, displaying
a window which has three buttons in it which do some dummy actions (for example, printing
"I was pressed" on the console) or drawing a circle in a Java window. Think
about it what classes do you need and how do these classes interact with
each other. You will also need two threads in this assignment. (Can you
explain why?)
The next two tutorials will be tailored to help you solving
this assignment. You will be given small sample tasks whose solution implement a subset
of this assignment. However, you will not be able to solve the entire assignment
from these tasks. "Putting everything together" and completing
this assignment will be done outside the tutorial time and it is your
responsibility.
Deliverables and Marking Scheme
You are required to:
- Demonstrate workability and functionality of your program in
your allocated tutorial in the week immediately after the due date.
- Provide the marker with a hardcopy of your source code on or before
the due date.
- Write a small html documentation index tree using javadoc .
You only need to document RunStopwatch.java . A sample documentation
tree is given here .
The assignment is worth a total 12 marks. These marks will be allocated as follows:
- 1 mark: for demonstration of your program in the tutorial after
the due date.
- up to 6 marks: for workability and functionality of your program.
- up to 3 marks: for code, code quality and design issues.
- up to 1 mark: for commenting your source code.
- up to 1 mark: for the html documentation tree generated from javadoc .