Great Deal! Get Instant $25 FREE in Account on First Order + 10% Cashback on Every Order Order Now

In-Class 2 – Alarm Clock This is the design of the alarm clock. The (sample) text in the time label and in the alarm time textbox are just to see what they’ll look like when the clock is running –...

1 answer below »

In-Class 2 – Alarm Clock
This is the design of the alarm clock. The (sample) text in the time label and in the alarm time textbox are just to see what they’ll look like when the clock is running – when created it must always show the cu
ent time to the second.
Double-click the form to create a Form Load method. Load the cu
ent time into the time label … hour, minute second, AM/PM. Also, consider saving here the form’s background colour into a private variable (i.e. of type System.Drawing.Color). Why? So that you can reset it after the timer is stopped (see below).
From the Component category in the toolbox, add 2 timers: 1 for a clock timer and another for an alarm timer. Have each issue a Tick event once a second. The clock timer is always active. When it issues a tick event, update the clock display and, if Alarm Activate is checked, check the alarm time.
The alarm timer is initially inactive. The user enters the alarm time in H:MM format with AM/PM, e.g. 3:11 PM. When the displayed time equals (to the second) the alarm time and “Is alarm active?” is checked, activate the alarm timer. That is, play a sound and every time it fires a tick event you may wish to alternate the clock face from red to green & back on each tick.
When “Use 24 hour clock?” is checked, display the clock in 24 hour format (0-23, e.g. 1PM=13) - the AM/PM must not be shown in this mode.
When Stop Alarm is clicked or the Alarm Active checkbox is unchecked, deactivate the alarm timer and reset the background colour (if you were changing that too).
To play a sound:
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
player.SoundLocation = @"c:\windows\media\Alarm01.wav";
Or 1 - 10, another wave file
player.Play();
Or: player.PlayLooping();
Marking:
1 – cu
ent time is displayed & stays cu
ent
2 – alarm sounds if alarm time equals clock time and Alarm Active is checked.
3 – alarm stops sounding when Stop Alarm is clicked
Note: the alternating red to green background colour is nice to have and not required to get 3/3.
Answered Same DayFeb 12, 2022

Solution

Aditya answered on Feb 12 2022
72 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here