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:.
|
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started