Assignment 2


Dates


Objectives

The purpose of this assignment is:

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: The assignment is worth a total 12 marks. These marks will be allocated as follows: