we are creating a software system for a pizza restaurant, one of the modules is supposed to handle the management of various pizza recipes and how the orders are put together, and a big part of the module will be the control of food types, the potential allergens in recipes, and calories counting.
you are commissioned to write a data-model API (classes, interfaces, etc) which will then be used by the entire module to exchange the data about the recipes, ingredients, and all that. And also couple helper function that demonstrate the usage of your data-model.
Create a data-model to represent pizza ingredients and pizza recipes, including the food types and allergens. Create a function hasAlle rgens where we can pass a certain pizza recipe and an array of allergens and receive true if the recipe contains any of the allergens. Create a function hasFoodTypes where we can pass a certain pizza recipe and an array of food types and receive true if this recipe contains any of the food types. Create functions removeAllergens and removeFoodTypes with similar parameters but they should return the same pizza recipe but with the allergens and food types removed. Create function removeIngredients where we can pass a certain pizza recipe and an array of ingredients and receive the pizza recipe without the specified ingredients. Create function doubleIngredients with the same parameters but it returns the recipe with the specified ingredients in double amount. Create function getCalories where we can pass a certain pizza recipe and it will return the number of total calories in that recipe.
Example of usage for the functions:
hasFoodTypeswhen user checks they want to only see pizza with mushrooms
hasAllergenswhen user wants to highlight any pizzas that might contain soy in it
removeIngredientswhen user checks they don’t want Jalapeño pepper
doubleIngredientswhen user checks they want double cheese
removeFoodTypeswhen user wants to check what the selected pizza will look like with no meat
getCalorieswhen user wants to check what the number will be for the resulting recipe
If you do not have the Rust toolchain installed, please follow instructions here: Install Rust
After cloning the repo, make sure you have the Rust toolchain installed with
rustc --version and
The following output is expected:
> rustc --version
rustc 1.55.0 (c8dfcfe04 2021-09-06)
> cargo --version
cargo 1.55.0 (32da73ab1 2021-08-23)
Running the program