1

In my organization I work on orders based on date, so earliest work orders first. We also have an option for order to be marked "priority" in which case those orders are done first but not always.

I've asked my boss some questions and I couldn't get answer that made sense...

  1. If one order has today's date, and another order has tomorrows date but is marked priority, which order should I work on first? He said the order marked "priority".

  2. If one order has today's date, and another order is dated 14 days from today and is marked priority, which order should I work on first? He said the one that has today's date.

So the problem is properly placing the order in queue, but it's not something they have an exact formula for.

If I was to make a class that only has two properties...

public class WorkOrder
{
    public DateTime dueDate;
    public bool isPriority;
}

What would be the most straightforward way to put them in queue?

1

1 Answer 1

2

As the priority marker doesn't always shift the items to the very front of the queue, you first need to find out by how many days the 'effective due date' shifts for priority items (my guess is that this would be somewhere between 2 and 5 days).

Once you have that information, you can have a class with three properties:

public class WorkOrder {
    public DateTime dueDate; // The real due date
    public bool isPriority;
    public DateTime effectiveDueData; // The due date adjusted for priority
}

This class can then be stored in a Priority Queue, where the items are first ordered on effectiveDueDate and (if for the same day) isPriority, so the priority items for a given effective due date are handled first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.