Question: I need help writing a C language program that assigns retail workers to customer orders in a time-efficient manner. The requirements are: 1. Assume 2
I need help writing a C language program that assigns retail workers to customer orders in a time-efficient manner. The requirements are:
1. Assume 2 categories of items for sale (books, electronics), each order has 10 items at most, and there are 5 initially available workers (Alice, Bob, Carol, Dave, Emma)
2. Each worker can be assigned to more than one customer order (bundling the orders) if all items in the orders are in the same category, but the total number of items can not exceed 10. For instance, if the items are all books and no more than 10 books in multiple orders, they may be bundled. The system should not read in the entire input file before processing orders.
3. If a worker has capacity to bundle, he or she waits to potentially bundle orders, but should not wait for more than 5 minutes.
4. only consecutive orders can be bundled; ie. older orders before newer ones.
5. Assume each worker needs 1 minute to find and pick each item in the same category and an additional 5 minutes of traveling time for each category.
6. Three singly linked lists must be used to manage customer orders, available workers, and worker assignments separately.
7. An input file containing customer orders will be used to simulate the customer orders. The input file is taken as a command-line argument and the output is printed to the screen.
Each input line is one of the following:
CustomerOrder orderTime customer numberOfBooks numberOfElectronics
PrintAvailableWorkerList printTime PrintWorkerAssignmentList printTime PrintMaxFulfillmentTime printTime
For simplicity, time is in HHMM format (HH: 00-23 and MM: 00-59), the leading zero is optional. Fulfillment Time is the amount of time between when an order is made and when a worker finishes picking items for the order(s). MaxFulfillmentTime is the longest Fulfillment Time among all the orders so far. AvailableWorkerList is in availability order. Ordering of WorkerAssignmentList is the expected completion time of a worker.
Each output line is one of the following:
CustomerOrder orderTime customer numOfBooks numOfElectronics WorkerAssignment assignmentTime worker customer1 customer2 ... OrderCompletion orderCompletionTime customer
AvailableWorkerList worker1 worker2 ... WorkerAssignmentList worker1:customer1 worker2:customer2a,customer2b ...
MaxFullfillmentTime numberOfMinutes
Sample Input 1:
CustomerOrder 0800 Frank 7 0 CustomerOrder 0801 George 0 9 CustomerOrder 0802 Harry 8 0 CustomerOrder 0803 Ivan 0 8 CustomerOrder 0804 John 5 0 CustomerOrder 0805 Kate 3 0 CustomerOrder 0806 Lily 1 0 PrintAvailableWorkerList 0810 PrintWorkerAssignmentList 0811 PrintMaxFulfillmentTime 0812
Sample Output 1:
CustomerOrder 0800 Frank 7 0 CustomerOrder 0801 George 0 9 WorkerAssignment 0801 Alice Frank CustomerOrder 0802 Harry 8 0 WorkerAssignment 0802 Bob George CustomerOrder 0803 Ivan 0 8 WorkerAssignment 0803 Carol Harry CustomerOrder 0804 John 5 0 WorkerAssignment 0804 David Ivan CustomerOrder 0805 Kate 3 0 CustomerOrder 0806 Lily 1 0 OrderCompletion 0808 Frank WorkerAssignment 0809 Emily John Kate Lily AvailableWorkerList 0810 Alice OrderCompletion 0811 George OrderCompletion 0811 Harry WorkerAssignmentList 0811 David:Ivan Emily:John,Kate,Lily OrderCompletion 0812 Ivan MaxFulfillmentTime 0812 10 OrderCompletion 0817 John OrderCompletion 0817 Kate OrderCompletion 0817 Lily
Sample Input 2:
CustomerOrder 0800 Frank 4 0 CustomerOrder 0801 Grace 5 0 CustomerOrder 0802 Harry 2 3 CustomerOrder 0803 Ivan 9 0 CustomerOrder 0804 Jack 0 8 CustomerOrder 0805 Kate 10 0 CustomerOrder 0806 Lily 7 0 PrintAvailableWorkerList 0807 PrintWorkerAssignmentList 0808 PrintWorkerAssignmentList 0820 PrintMaxFulfillmentTime 0900 CustomerOrder 0901 Mike 4 0 CustomerOrder 0902 Nancy 0 4 CustomerOrder 0904 Olive 3 4
Sample Output 2:
CustomerOrder 0800 Frank 4 0 CustomerOrder 0801 Grace 5 0 CustomerOrder 0802 Harry 2 3 WorkerAssignment 0802 Alice Frank Grace WorkerAssignment 0802 Bob Harry CustomerOrder 0803 Ivan 9 0 CustomerOrder 0804 Jack 0 8 WorkerAssignment 0804 Carol Ivan CustomerOrder 0805 Kate 10 0 WorkerAssignment 0805 David Jack WorkerAssignment 0805 Emily Kate CustomerOrder 0806 Lily 7 0 AvailableWorkerList 0807 WorkerAssignmentList 0808 Alice:Frank,Grace Bob:Harry Carol:Ivan David:Jack Emily:Kate OrderCompletion 0811 Frank OrderCompletion 0811 Grace OrderCompletion 0812 Harry OrderCompletion 0813 Ivan OrderCompletion 0813 Jack OrderCompletion 0815 Kate WorkerAssignment 0816 Alice Lily WorkerAssignmentList 0820 Alice:Lily OrderCompletion 0823 Lily MaxFulfillmentTime 0900 17 CustomerOrder 0901 Mike 4 0 WorkerAssignment 0902 Bob Mike CustomerOrder 0902 Nancy 0 4 WorkerAssignment 0904 Carol Nancy CustomerOrder 0904 Olive 3 4 WorkerAssignment 0904 David Olive OrderCompletion 0906 Mike OrderCompletion 0908 Nancy OrderCompletion 0916 Olive
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
