Question: Exercise 2: You are to develop a simple queue system for a customer service counter, based on singly linked lists. Customers are processed first come,

Exercise 2:

You are to develop a simple queue system for a customer service counter, based on singly linked lists.

Customers are processed first come, first served from the front of the queue, while new customers join at the end of the queue. (This is known as FIFO or First In First Out.)

Implement the queue system using a singly liked list. You need to have both head and tail pointers, to the first node (front) and last node (end), respectively, in order to manage the queue.

Your program should display a menu for the user to choose an option, as follows:

  1. Add a customer to the queue
  2. Serve the next waiting customer
  3. Print all customers in the queue
  4. Exit

For options #1, your program should ask the user to enter a customer name (string) and add it at the end of the queue.

Option #2, print customers name to be served and delete the customer from queue.

Option #3, print customer names waiting in the queue along with the count.

Option #4, exit the program.

Sample input and output:

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!