 |
b). Open the clock-display-alarm project. This project
simulates the behaviour of a clock display similar to the one in
chapter 3 of the Bluej book but with added functionality for setting
an alarm. Create a new object of ClockDisplay type. Invoke the
setTime method with parameters 6 and 29 (the clock is set to
06:29 am). Inspect the object and verify that the displayString
field reflects this change. Now invoke the setAlarm method with
parameters 6 and 30 (alarm is set at 06:30 am). You will notice that
the alarmSet field has changed from false to true
as a result of this. When invoking the timeTick method, this
program should print the message `It's 06:30 already!' to the
terminal. However if you invoke this method you will find that this
doesn't happen. There is an error in this program. Your task is to use the
Bluej debugger to try and spot where the error is. Make sure you set
some breakpoints, single-step, step-into and
inspect some of the instance and local variables. Do this when
invoking both the setTime and timeTick methods. The point of
this exercise is to make sure you can use the Bluej debugger, rather
than to actually spot the error.
| Last updated at 8:57pm, Thursday September 22nd 2011 |
Dr Natalia Beloff (N.Beloff@sussex.ac.uk) |
|
|
|
|