Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

please please !!! how to create Alarm Clock

thientanchuongthientanchuong Posts: 5Member
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
Or http://www.megaupload.com/?d=XSU7RAE6

NumberDisplay : http://download.yousendit.com/28E2B7F867D07280
Or http://www.megaupload.com/?d=BPMZL5GR

BlueJ programme: http://www.bluej.org/download/download.html

Tasks:
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.
buzz!
buzz!
buzz!
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.)

Comments

  • zibadianzibadian Posts: 6,349Member
    : 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
    : Or http://www.megaupload.com/?d=XSU7RAE6
    :
    : NumberDisplay : http://download.yousendit.com/28E2B7F867D07280
    : Or http://www.megaupload.com/?d=BPMZL5GR
    :
    : BlueJ programme: http://www.bluej.org/download/download.html
    :
    : Tasks:
    : 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.
    : buzz!
    : buzz!
    : buzz!
    : 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.)
    :
    1) Creating new classes is lesson 1 of Java. You should know that.
    2) Add a field to your class, indicating which clock is being referred to by the various methods in your class. Then create getter and setter methods for the time:
    [code]
    private int clock;

    public Calendar getTime() {
    if (clock == 1) return timeClock.getTime();
    else return alarmClock.getTime();
    }

    public void setTime(Calendar value)
    [/code]
    3) Create a File field with appropiate getter/setter methods.
    4) Create a boolean field with appropiate getter/setter methods.
    5) Create a field with the snooze interval and one to indicate if snooze is enabled (see 4). If snooze is enabled and clock time == alarm time + snooze interval, then play the alarm again
    6) Finally Create a boolean field with appropiate getter/setter methods. The setter method should also apply the time-difference to the timeClock, besides setting the value.
  • thientanchuongthientanchuong Posts: 5Member
    : : 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
    : : Or http://www.megaupload.com/?d=XSU7RAE6
    : :
    : : NumberDisplay : http://download.yousendit.com/28E2B7F867D07280
    : : Or http://www.megaupload.com/?d=BPMZL5GR
    : :
    : : BlueJ programme: http://www.bluej.org/download/download.html
    : :
    : : Tasks:
    : : 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.
    : : buzz!
    : : buzz!
    : : buzz!
    : : 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.)
    : :
    : 1) Creating new classes is lesson 1 of Java. You should know that.
    : 2) Add a field to your class, indicating which clock is being referred to by the various methods in your class. Then create getter and setter methods for the time:
    : [code]
    : private int clock;
    :
    : public Calendar getTime() {
    : if (clock == 1) return timeClock.getTime();
    : else return alarmClock.getTime();
    : }
    :
    : public void setTime(Calendar value)
    : [/code]
    : 3) Create a File field with appropiate getter/setter methods.
    : 4) Create a boolean field with appropiate getter/setter methods.
    : 5) Create a field with the snooze interval and one to indicate if snooze is enabled (see 4). If snooze is enabled and clock time == alarm time + snooze interval, then play the alarm again
    : 6) Finally Create a boolean field with appropiate getter/setter methods. The setter method should also apply the time-difference to the timeClock, besides setting the value.
    :
    THANKS FOR GUILDING ME THESE STEPS.


Sign In or Register to comment.