Question
USE C++ PROGRAMMING LANGUAGE DO NOT USE any of the STL in your code. You can include for reading in the input file. Donut Shop
USE C++ PROGRAMMING LANGUAGE
DO NOT USE any of the STL in your code. You can include
Donut Shop
Implement a Queue ADT for storing a list of donut orders. The class must be named DonutQueue and must be implemented using a static circular array of Orders.
Creating an order
Make a class named Order as a data member of DonutQueue. Each order has an order number, flavor, and quantity. Create a constructor with the arguments (string flavor, int quantity). You should keep track of the order number using a data member of DonutQueue, which starts at 1 and increases after each order is made.
Reading in Orders
Do NOT hard code any data except for the filename. You should be reading in a list of orders from orders.csv using file I/O. Initialize an array of size 7 and add items until you reach the end of the file. If the queue is full, print a message that you currently cant take any more orders.
orders.csv file format, just separate the attribute using comma with format flavor,quantity, ex:
Lemon, 2
Apple, 5
Operations
Implement basic class functions (default and copy constructors, destructor, copy assignment) and basic queue functions (enqueue, dequeue, getSize). Use the circular array approach when adding orders. In dequeue, print which order was fulfilled instead of returning the order. An execution example for dequeue and all the additional functions are shown on the next page.
Implement the following operations: getQuantity(string flavor): finds all orders of the flavor and returns the total quantity.
printOrders(): prints all orders on the list starting from the earliest to the most recent order. printArray(): prints the order number at each index of the array, including the empty cells.
EXECUTION EXAMPLE
Your class files should support tests such as these:
DonutQueue d = DonutQueue();
//code for reading in orders.csv
d.dequeue(); // prints Order #1 ready! Good Ol Glazed x 6
d.dequeue(); // prints Order #2 ready! Sprinkles x 1
d.enqueue("Sprinkles", 2);
cout << "We have to make " << d.getQuantity("Sprinkles") << Sprinkled donuts. << endl; //prints We have to make 7 Sprinkled donuts.
DonutQueue d2 = d; d2.printOrder();
prints
Order #3 Nutty Vanilla x 2
Order #4 Lemon Poppy x 4
Order #5 Chocoloco x 3
Order #6 Sprinkles x 4
Order #7 Lemon Poppy x 7
Order #8 Sprinkles x 2
d2.printArray();
prints
arr[0] = Order #8 arr[1] = no order arr[2] = Order #3 arr[3] = Order #4 arr[4] = Order #5 arr[5] = Order #6 arr[6] = Order #7 NOTE: PLEASE GIVE COMPLETE ANSWER AND DON'T COPY OTHER'S ANSWER.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started