Drink Menu Terminal Program

Description

The basic premise of this program is to allow users to narrow down a large list of cocktail recipes based on the ingredients which they want the recipes to contain. The program lets users enter one or more ingredients--say, "Bourbon" and "lime juice"--and then spits out the number of recipes which call for both of these ingredients. The user may then view the list of all such matching recipes--just one in the case of Bourbon and lime juice: the "New Yorker"--and may then open the full recipe right there in the terminal.

Implementaiton Overview

The source code for this project is written entirely in C++, which includes four source files and their associated headers. They are 1) main, used to launch the UI; 2) menuUI, used to manage user commands and to oversee their execution; 3) IngredientGraph, an ADT for ingredient data; and 4) RecipeList, an ADT for recipe data. Data for this program is stored and accessed using 2 CSV files: one to match ingredient names to IDs, and one to match recipe names to one or more ingredient IDs as well as the relative file path of a text file containing that recipe's full text.

Design Highlights and Specifics

Abstract Data Types

Two of the source files are custom Abstract Data Types, one of which is used to store data about ingredients in a tree, and to allow users to retrieve an entire branch of that tree (done via a recursive function). The other custom ADT is a more straightforward list containing data on recipes, which allows users to submit queries based on ingredient IDs.

Querying Algorithm

In the IngredientGraph class, nodes of ingredient data are stored in a tree, with more specific types of ingredients being the children of more generic types, i.e. "Scotch" is the child of "whisky", "single malt" and "blended" are the children of "Scotch", and so forth (data for generating this tree is contained in one of the CSV files). When a user adds an ingredient to the queue, the program adds the entire branch from the graph with that ingredient as the root. Thus, a user may enter "whisky" and will see recipes which only call for scotch, as well as recipes which call for other types of whisky. Likewise, a user may enter "scotch" and will see recipes which only call for "single-malt scotch" or "blended scotch", or just "scotch", but will not see recipes which call for "Bourbon".

Educational Takeaways