Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task is to develop a structural program that simulate a queueing system at the pharmacy store. The customers (on their vehicles) will come to

Your task is to develop a structural program that simulate a queueing system at the pharmacy store. The customers (on their vehicles) will come to the store at the given time. They will need to drive their vehicles to get in the line (queue). We prioritize the customers who plan to have a quick service (just pick up medication then leave). There is only one pharmacy technician at the drive-thru window serves customer one at a time. The customer in front of the line will be served if there is no customer being served. The customer at the drive-thru window has to wait for the pharmacy technician to process the order. After the order is processed, the customer leaves the window.

You are provided eight different files: Vehicle.h, Vehicle.cpp, ArrayList.h, ArrayList.cpp, ArrayQueue.h, ArrayQueue.cpp, Simulation.h, Simulation.cpp, and some test files. You are NOT allowed to modify header files (.h files) and only modify the body of methods in the implementation files (.cpp files). Please find the TODO tags for where you need to place your code. You are NOT allowed to add any extra standard library or external library in the cpp files. Using extra library will cause a grade of zero. The tables below depict the methods and functionality for each class:

Place your code in a cpp files named Vehicle.cpp, ArrayList.cpp, ArrayQueue.cpp, and Simulation.cpp.

Each method should follow the direction as following:For the Vehicle.cpp file:

Implement the constructor for the class

Implement the method get_name to simply return the attribute of the class.

Implement the method get_arrival_time to simply return the attribute of the class.

Implement the method get_processing_time to simply return the attribute of the class.

Implement the method get_start_time to simply return the attribute of the class.

Implement the method set_start_time to accept a start time at the drive-thru window.

For the ArrayList.cpp file:

Implement the constructor for the class

Implement the method size to simply return the attribute of the class.

Implement the method expand to expand the capacity of the list then copy all items from the old array to the new array.

Implement the method insert to insert an item into the list then increase the value of size reference.

Implement the method get to validate the index if it is in bound. The method returns the item at the given index. The method throws logic_error if the index is out of boundary.

Implement the method removeAt to validate the index if it is in bound. The method after removes the item at the given index should do the shifting.

Implement the method sort to sort the items in the list. Any sorting algorithm will be accepted but no extra method (helper method) will be allowed.

For the ArrayQueue.cpp file:

Implement the constructor for the class

Implement the method is_full to check if the number of items in the queue reached the capacity.

Implement the method is_empty to check if the queue is empty.

Implement the method peek to get the item in the front of the queue. The method throws logic_error if the queue is empty.

Implement the method enqueue to return false if the queue is full, otherwise, inserts the item to the back and returns true.

Implement the method dequeue to return false if the queue is empty, otherwise, starts shifting the item from the beginning of the queue to remove the front item and returns true.

For the Simulation.cpp file:

Implement the constructor that accept a file path as string. Read every line from the text file into a list of vehicles (ArrayList<Vehicle>). Sort the list to prioritize the criteria of arrival time and processing time.

Implement the method done to check if there is no customer coming and in the line and at the drive-thru window then return true, otherwise, returns false.

Implement the method step (the main method of the simulation) put the customer(s) from the list into the queue at the right time (arrival time), removes the customer in the front of the queue and place the customer into the current transaction if no customer at the drive-thru window.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

ISE Managerial Accounting For Managers

Authors: Eric Noreen, Peter C. Brewer, Ray H. Garrison

5th Edition

1260570010, 9781260570014

More Books

Students also viewed these Accounting questions