Subject: Data Structure and Algorithm
Simulate a real-life Queue System
In places like a bank counter or a ticket counter, customers wait in line to be served in the order they arrive this is a perfect example of a linear queue following FIFO (First In, First Out).
What your program should do
- Add customers to the queue (enqueue) when they arrive.
- Serve (dequeue) the customer at the front when it’s their turn.
- Show the current queue (list of waiting customers).
- Handle cases when the queue is empty (no one to serve) or full (if using a fixed-size array).
Example scenario
- Customer A arrives → added to the queue.
- Customer B arrives → added to the rear.
- Customer C arrives → added to the rear.
- Serve a customer → Customer A is served (front of the queue).
- Serve the next → Customer B is served.
Data you can track
- Customer name or number (e.g., "Customer A", "Customer B").
- Arrival time (optional, but adds realism).
- Queue size or maximum capacity (if you want to limit the queue).