Intro: 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.

Overview

rust_pizzeria

Intro:

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.

Requirements:

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.

Tasks:

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:

  • hasFoodTypes when user checks they want to only see pizza with mushrooms
  • hasAllergens when user wants to highlight any pizzas that might contain soy in it
  • removeIngredients when user checks they don’t want Jalapeño pepper
  • doubleIngredients when user checks they want double cheese
  • removeFoodTypes when user wants to check what the selected pizza will look like with no meat
  • getCalories when user wants to check what the number will be for the resulting recipe

Setting up

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 cargo --version

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 tests

cargo test

Running the program

cargo run
You might also like...
Recipes for avoiding bounds checks in Rust, without unsafe!

Recipes for avoiding bounds checks in Rust This repository showcases various approaches to avoiding bounds checks in Rust code, without unsafe code. E

Rust implementations of finite-field arithmetic based on big integers with configurable limb sizes

multiprecision TODO: rewrite readme implement CIOS for 16-bit limbs All operations are in little-endian form (where the digit in memory at the smalles

(early experiments toward) a version-control system for structured data
(early experiments toward) a version-control system for structured data

chit: (early experiments toward) a version-control system for structured data please note, very little is actually implemented here. this is not usefu

LearnRustTogether - Let's learn Rust together
LearnRustTogether - Let's learn Rust together

Curated collection of lists of useful resources to learn Rust together. List of forums and chats you may find here. I encourage you to seek for help i

In this repository you can find modules with code and comments that explain rust syntax and all about Rust lang.
In this repository you can find modules with code and comments that explain rust syntax and all about Rust lang.

Learn Rust What is this? In this repository you can find modules with code and comments that explain rust syntax and all about Rust lang. This is usef

Crabzilla provides a simple interface for running JavaScript modules alongside Rust code.

Crabzilla Crabzilla provides a simple interface for running JavaScript modules alongside Rust code. Example use crabzilla::*; use std::io::stdin; #[i

A cargo plugin for showing a tree-like overview of a crate's modules.

cargo-modules Synopsis A cargo plugin for showing an overview of a crate's modules. Motivation With time, as your Rust projects grow bigger and bigger

📱️🚫️🌝️💾️ 3FakeIM is a joke program meant to imitate various fictional characters, and the
📱️🚫️🌝️💾️ 3FakeIM is a joke program meant to imitate various fictional characters, and the "[CHARACTER] CALLED ME AT 3:00 AM" clickbait trend, while poking fun.

3FakeIM 📱️🚫️🌝️💾️ 3FakeIM is a joke program meant to imitate various fictional characters, and the "[CHARACTER] CALLED ME AT 3:00 AM" clickbait tre

The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language.

rcc The Rust Compiler Collection is a collection of compilers for various languages, written with The Rust Programming Language. Compilers Language Co

Owner
Flavio Rasseli
Senior backend developer
Flavio Rasseli
OP-Up is a hive tool for testing OP-Stack-compatible software modules

op-up Warning This is a work in progress. OP-Up is a hive tool for testing OP-Stack-compatible software modules. This project was born out of the need

nicolas 20 Jun 13, 2023
Unify your game sources in one place and aquire more of them, using modules made by the community.

Project Black Pearl Unify your game sources in one place by using modules made by the community. What is Project Black Pearl? Project Black Pearl (or

Project Black Pearl 8 Jan 15, 2023
Idiomatic Rust implementations for various Windows string types (like UNICODE_STRING)

nt-string by Colin Finck <[email protected]> Provides idiomatic Rust implementations for various Windows string types: NtUnicodeString (with NtUnicode

Colin Finck 5 Jun 4, 2023
RcLite: small, fast, and memory-friendly reference counting for Rust

RcLite: small, fast, and memory-friendly reference counting RcLite is a lightweight reference-counting solution for Rust that serves as an alternative

Khashayar Fereidani 147 Apr 14, 2023
Bioinformatics tool for counting guides in CRISPR-screen studies.

guide-counter A better, faster way to count guides in CRISPR screens. Overview guide-counter is a tool for processing FASTQ files from CRISPR screen e

Fulcrum Genomics 21 Oct 17, 2022
Code sample for "Reading files the hard way Part 3"

read-raw-ext4 Rust code sample to read an ext4 partition from Rust, for: https://fasterthanli.me/series/reading-files-the-hard-way/part-3 Usage Don't.

amos 10 Mar 25, 2023
Rust Programming Fundamentals - one course to rule them all, one course to find them...

Ultimate Rust Crash Course This is the companion repository for the Ultimate Rust Crash Course published online, presented live at O'Reilly virtual ev

Nathan Stocks 1.3k Jan 8, 2023
A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments.

Zerokit A set of Zero Knowledge modules, written in Rust and designed to be used in other system programming environments. Initial scope Focus on RLN

vac 44 Dec 27, 2022
Operating system based off of blog_os, with the goal of running wasm modules as executables

yavkOS - A OS that attempts at running WASM modules as userspace programs Recommended Development Environment You need nix with the flakes, and nix-co

Yavor Kolev 12 Apr 1, 2023
Highly experimental, pure-Rust big integer library

grou-num (Pronounced "groo", from the Chiac meaning "big") This package is a highly experimental, unstable big integer library. I would not recommend

Patrick Poitras 1 Dec 18, 2021