From the course: C# Hands-on Practice with Data-Structures

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Implement a queue for processing customer requests

Implement a queue for processing customer requests - C# Tutorial

From the course: C# Hands-on Practice with Data-Structures

Implement a queue for processing customer requests

Let's implement a queue for processing customer requests. Each item in the queue will be represented with a ticket. The ticket has an owner, description, and priority, where the priority is low, medium, or high. The TicketService will manage these tickets so they are processed in the correct order. We'll start by creating three queues, one for each type of priority. When a new ticket comes in, we'll add it to the appropriate queue based on priority. Then when it's time to process a ticket, we'll look at the high-priority queue first and process those before processing any in the other queues. If the high-priority queue is empty, we'll begin processing from the medium-priority queue. If both the high-priority and medium-priority queues are empty, we'll take tickets from the low-priority queue. This means when adding a ticket, we'll need to look at the ticket's priority. Based on priority, we'll add it to the appropriate queue. Then we'll retrieve the next ticket based on priority. If…

Contents