Question: Implement a FIFO like data structure using Linked list for the customer queue in a service center. Whenever a customer is added, it will be

Implement a FIFO like data structure using Linked list for the customer queue in a service center. Whenever a customer is added, it will be added at the end of the list. On the other hand, whenever a customer is served, it will remove a customer from the head as head contains the oldest items. A customer has a name (string) and a serial number (int). This serial number is auto incremented by one whenever someone is added in the list. The node looks like this:.

Name

SerialNo

Next

Create a menu where the user will choose the operation he/she wants to perform until x is pressed. The menu is:

Press e to enter a new customer to add into the linked list

Press r to remove a customer from the list

Press x to exit

- Choosing the option e will allow the user to give a string name (name might have space) as input. Maintain a global variable for serial number and increment it by one to add the serial number to the new customer. After adding the customer, please display the current name and serial numbers in the list like a comma separated tuples. The output should look like this (name1, SerialNo1), (name2, SerialNo2), .. (name n, SerialNo n)

- Choosing the option r will remove a customer from the head. After deleting the item, display the linked list as discussed in the above option.

- Choosing the option x will exit the program.

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!