- Joined
- Oct 18, 2017
- Posts
- 1,879
- Solutions
- 16
- Reaction
- 2,643
- Points
- 1,040
di ko talaga kasi makuha baka may idea kayo dito. Maraming salamat!
Lab Exercise # 4 - Circular Queues
A restaurant accepts a maximum number (5) of orders at a time. The customers are served on a first come, first served basis. Orders are served every 60 seconds and cannot be cancelled once they are placed. Every time an order is served, a slot in the queue will become available and a new order can be taken.
Write a program that will implement this restaurant order system using a circular queue. The program will do the following:
1. Place customers in a queue.
2. Display whether the queue is full or not.
3. If not yet full, the queue will take in orders until max number of orders is reached.
4. If full, the queue cannot take in an order.
5. Every 60 seconds, an order will be served and will be taken out of the queue. Program displays a prompt allowing new order into the queue.
Example execution:
Enter customers:
a
b
c
d
e
queue is: a, b, c , d, e
Reservation queue is full!
[After 60 seconds] - 1 slot is available.
Enter a new customer: f
queue is: b, c, d, e, f
Lab Exercise # 4 - Circular Queues
A restaurant accepts a maximum number (5) of orders at a time. The customers are served on a first come, first served basis. Orders are served every 60 seconds and cannot be cancelled once they are placed. Every time an order is served, a slot in the queue will become available and a new order can be taken.
Write a program that will implement this restaurant order system using a circular queue. The program will do the following:
1. Place customers in a queue.
2. Display whether the queue is full or not.
3. If not yet full, the queue will take in orders until max number of orders is reached.
4. If full, the queue cannot take in an order.
5. Every 60 seconds, an order will be served and will be taken out of the queue. Program displays a prompt allowing new order into the queue.
Example execution:
Enter customers:
a
b
c
d
e
queue is: a, b, c , d, e
Reservation queue is full!
[After 60 seconds] - 1 slot is available.
Enter a new customer: f
queue is: b, c, d, e, f