Question: C# Program using Delegates to create a countdown clock that can be set, paused and restarted by the user. I have seen a lot of

C# Program using Delegates to create a countdown clock that can be set, paused and restarted by the user. I have seen a lot of countdown timers, however none of them allow the user to interact with the clock which is a must. Thanks in advance for the assistance.

* Write a countdown alarm clock program that uses delegates to notify anyone who is interested that the designated amount of time has passed.

* Youll need a class to simulate the countdown clock that accepts a message and a number of seconds to wait (supplied by caller).

* After waiting the appropriate amount of time, the countdown clock should call the delegate and pass the message to any registered observers.

* (When you're calculating the time to wait, remember that Thread.Sleep() takes an argument in milliseconds, and requires a using System.Threading statement.)

* Your countdown clock class should contain a way to create and set the clock appropriate data, a way to start the alarm clock running, a way to pause the alarm clock, a way to resume the countdown, and a way to abort the alarm clock.

* Create an observer class that echoes the received message to the console. Be certain that the event can be published to multiple handlers safely.

* Create a driver that demonstrates your program using at least 3-4 observers along with at least 2-3 different usages of the alarm clock with times in the range 3-10 seconds. Be certain that your driver demonstrates the complete functionality of your alarm clock by exercising each of its methods at least once.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!