Assignment 3: Time Display

Purpose

The purpose of this program is to learn the Model-View-Controller architecture and gain familiarity with Java's MVC facilities.

The Problem

You must modify your analog clock program to use the Model-View-Controller architecture to add two additional views: the slider view and the spinner view. Users should be able to modify the time through the text field, sliders, or spinners, and all the views should update accordingly.

The requirements of the project are:

Hints

Your model should extend java.util.Observable. All the information about the time and methods for changing the time should be in the model. Any method that changes the state of the model should call setChanged() and notifyObsvers() after it has actually changed the state.

Each view should implement the java.util.Observer interface and hence implement the update() method. Each view should register itself with the model using the model's addObserver() method. The Model will call each registered view's update() method when its state is changed. So, in your update() methods, you should define how to change your view. The controllers are the classes that implement the listeners and call the methods in the model to change the state of the model.

For an example on how to implement the MVC architechture using Observable and Observer, see Building Graphical User Interfaces with the MVC Pattern and Observer and Observable.

Coding style

Your code submitted so far does not follow good coding standards. To help you with your coding style, you need to use the Critic to check your code. Use your last name as your user name, and send an email to lqiu@oswego.edu for password.

The Critic will check for style problems in your code and generate critiques. Follow the critiques and fix all the problems before submission. You are free to try the Critic on your code as many times as you want.

After you submit your code to lqiu@oswego.edu, I will use the Critic to check your code. You will have 10 points off for each critique generated by the Critic. This is to make sure that you correct all the style problems before submission.

Report any login or server problem to lqiu@oswego.edu.

Submitting

Submit your program by creating a zip file with your last name as the file name containing all the source code files related to your project, email to lqiu@oswego.edu with "CS520 Project 3 - your name" as the subject.

When I extract your zip file, your zip file should create a directory with your last name and all the code should be in that directory. Do not send your source code directly as attachment to your email because some email program may add line-ending characters to your code which makes it fail to compile on my machine.

Grading rubrics

  • Total: 100
  • Extra points: 10 points for each additional view, e.g., three drop-down lists for users to choose the value for hour, minute and second.
  • late policy as described in the course syllabus.
  • Due date

    This program must be received by 11:59pm EDT on 3/23 to not be considered late.