Hello, I am recently a first year IT student and a beginer of Java. I have a homework that will be similar to a part of my coursework but I do not know how to do.
Could any one teach me how to figure out my homework. if you can help , it means you save my life.
please can you explain each step to me (I am a beginer and need to understand so that I can work well on my coursework)
This is a topic:
Creating ALARM CLOCK
this homework is to enhance the clock-display project by adding alarm and time-zone functionalities. It will involve creating a new class called AlarmClock. Just as ClockDisplay creates two NumberDisplay objects (one for the hours and one for the minutes), AlarmClock will create two ClockDisplay objects, (one for the current time and one for the time that the alarm is set to go off). The program is run by calling methods of an AlarmClock object from the BlueJ object bench and using the object inspector to observe the state of that object and the two resulting ClockDisplay objects.
data to download:
ClockDisplay : http://download.yousendit.com/EA399FFA0BA4BE52
NumberDisplay : http://download.yousendit.com/28E2B7F867D07280
BlueJ programme: http://www.bluej.org/download/download.html
The tasks involve creating a new class called AlarmClock and developing it by adding the methods stated and any additional code that is necessary in order for them to operate correctly. Initial settings for the alarm clock should be as follows:
Current time and alarm time both set to 00:00
Alarm clock in time mode
Alarm switched off
Ringtone set to "buzz!"
Number of rings set to 30
1) Create a new class called AlarmClock that creates two ClockDisplay objects (one for the current time and one for the time that the alarm is set to go off).
2) To set the time on a real digital alarm clock, it is common to first select either time mode (for the current time) or alarm mode (for the time that the alarm will go off) and then make the adjustments. Add a method that toggles between the two modes (i.e. changes from one mode to the other when it is called) then add a method to change either the current time or the alarm time depending on which mode is currently selected.
3) Add a method to choose a ringtone (i.e. some sort of sound or voice message). The method should use a switch statement to set the value of a String object representing the ringtone, depending on the value of
its int parameter. For example, if the parameter value is 1 then it might set the value to "ring!", if it is 2 then it might set it to "please wake up" etc. You should include 5 different ringtones for the numbers 1-5 and, if the method is called with a parameter outside this range, it should set the ringtone to "buzz!". Add another method to specify how many times the ringtone will sound when the alarm goes off.
4) Add a method that toggles the alarm between being on and off (i.e. changes from one to the other when it is called). Add another method that progresses the current time by one minute (i.e. makes the appropriate ClockDisplay object "tick") and then checks the current time against the alarm time. If they
match and the alarm is turned on then this method should print the ringtone to the console the set number of times e.g.
otherwise it should do nothing.
5) Add a method that represents a snooze function by adding the time in minutes, specified by the parameter of the method, onto the alarm time. (Hint: Make the appropriate ClockDisplay object "tick" for each minute the alarm time is being put forward. Note that this is not quite like a real snooze function
because this will have the effect of setting the alarm to go off at this later time the following day.)
6) Add a method to change time zone. If its parameter is in the range -23 to +23 then it should change the current time by that many hours, otherwise it should do nothing. (Hint: If the time change is negative then first convert it to a positive value. For example, changing time zones from London to New York would
usually be expressed as a change of -5 hours but, because the clock does not store days or dates, this is equivalent to a change of +19 hours. Then make the appropriate ClockDisplay object "tick" for each minute the clock is being put forward. (It does not matter if the act of changing the time zone causes the
alarm to sound.)