1.Create a class called Person.

Person has the following read only attributes:

  • First Name
  • Last Name
  • Birth Date

2.Create a class called YourQueue which inherits the functionality of the .Net Queue collection class.

3.Override the functionality of the Dequeue() method as follows:

  • If the object being dequeued is a Person then raise an event called PersonDequeued and pass reference to the Person object being dequeued.
  • If the object being dequeued is not a Person then raise an event called NonPersonDequeued and pass reference to the Object being dequeued.

4.In the Form1_Load() method of your form:

A.Create the following people objects: see image.

B.Declare and instantiate a variable of type YourQueue called MyPeople:

YourQueue MyPeople = new YourQueue();

C.Subscribe to the NonPersonDequeued event.

Provide a Message Box in the MyPeople_NonPersonDequeued() method to display as follows (red box indicates place holder where information obtained from the Object is to be displayed): see image.

D.Subscribe to the PersonDequeued event.

Provide a Message Box in the MyPeople_PersonDequeued() method to display as follows (red box indicates place holder where information obtained from the Person is to be displayed): see image.

E.Enqueue your 3 people from above!

F.Also Enqueue "Mickey Mouse" (not a Person)

G.Call MyPeople.Dequeue() 4 times.

Output: see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.