Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
In general all fast food chains like McDonalds, Subway, and other drive-ins follow queue model to take the order and serve. When a user enters the desk, his order is pushed into the system. The stewards, cook/arrange the order based on the queue inside kitchen. Once the order is prepared, it will dequeued of kitchen queue.
1. Let us consider a queue of 10. More than 10 display queue is full message.
2. Customer approach different desks/counters at same time. In each counter they are asked for the order. Entire order details are stored in a data structure and pushed/enqueued into the kitchen queue.
3. Every order is at service desk. Amount of their order is mentioned at the end. For this we need list of items and their respective prices are stored in item list. At the end of the order the total amount is calculated. At payment, let us assume same order is reflected in the kitchen. This is one push operation.
4. The values inside queue elements would be the order and the quantity.
5. Once the order is prepared and delivered a pop/dequeue operation removes the front order and stores them in a file with a transaction number.
6. Until the front order is complete. Order is not popped out/dequeued. When the queue of 10 is not served that means the queue is full. The desks have to wait
7. Simulate desks scenarios using a random number mod 3/4 operation representing each desk. And these orders are placed in the queue based on the order generated by random number.
0 · ·