Lab 8
Alarm Clock
We will be designing and building a clock application using the design patterns and principles we learned in class. We will be working in teams of four. You should divide the work when possible to have 2 pairs of programmers working, perhaps one pair working on the Model and one pair working on the View and Controller.
You may need to learn how to merge the work of two pairs on github. Your repository will be named ClockTeamn, with 0<'n'<7
We will start by building a clock with the ability to set the time manually. Your clock will have six digits like this: XX:XX:XX. You may want six buttons at this stage:
* Lock (prevents accidentally changing the time) * Set time (Unlocks the set time functions) * Hour * Minute * Up * Down
If you have a different idea for the set of buttons, that's fine.
Once the basic clock is done, as time permits, expand this app to include an alarm function. If you're really zooming along, a timer function would be a nice addition.
Since the Up and Down buttons will be doing different things at different times, let us implement the Up and Down actions as strategies. You could create a strategy interface, and a strategy class for each functional use of the up/down buttons (so far, there's just the time set function, later on they can be used to set the alarm time). You should create a strategy variable to remember the current state (time, time set, alarm set, etc.) The current-strategy variable can be used to determine which strategy should be created for the up and down buttons.
The pair working on the View should design something with an interesting look. You might want to look at some clocks online. You could use an image or for each digit, and redraw the clock every second using the correct images, or you might consider each digit to be a seven segment led, and light up the correct segments to represent each digit, or you might think of something entirely different.
I suggest that each team create a class diagram first.
Please include a jUnit test framework in your project. It is unreasonable to test the GUI within this framework, but you can test your model with it.
Enjoy!