This project is a Food Court Token System, designed to manage and prioritize food orders efficiently. It was developed as a submission for a Data Structures and Algorithms (DSA) course project.
The Food Court Token System allows users to add, dequeue, and clear food orders. Each order is assigned a preparation time and a timestamp, which are used to prioritize the orders. The system ensures that orders with shorter preparation times are processed first, and in case of a tie, the order that was placed earlier is given priority.
- Add Order: Users can add a new order by entering the order name and selecting the category, which determines the preparation time.
- Dequeue Order: The highest priority order (based on preparation time and timestamp) is removed from the queue.
- Clear Queue: All orders are removed from the queue.
- Order Display: The current queue of orders is displayed, showing the order name, category, and preparation time.
- Array: The
orderQueue
is implemented as an array to store the list of orders.
- Sorting: The
updateQueue
function sorts the orders based on preparation time and timestamp using a custom comparator function. - Priority Queue: The sorting mechanism effectively implements a priority queue, where orders with shorter preparation times and earlier timestamps are given higher priority.
script.js
addOrder
: Adds a new order to the queue and updates the display.dequeueOrder
: Removes the highest priority order from the queue and updates the display.clearQueue
: Clears all orders from the queue and updates the display.updateQueue
: Sorts the orders and updates the display.
styles.css
- Contains the styling for the application, including the layout and appearance of the order items and buttons.
index.html
- The main HTML file that includes the structure of the application and links to the JavaScript and CSS files.
The application is deployed at https://fctoken1.netlify.app/.
- Open the application in a web browser.
- Enter the order name and select the category.
- Click "Add Order" to add the order to the queue.
- Click "Dequeue Order" to remove the highest priority order from the queue.
- Click "Clear Queue" to remove all orders from the queue.
This project demonstrates the use of basic data structures and algorithms to manage and prioritize food orders in a food court setting. It showcases the practical application of sorting and priority queues in a real-world scenario.