Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

Explain an application of K-means clustering.

Answered: 1 week ago