Skip to content

Instantly share code, notes, and snippets.

@Caballerog
Created June 11, 2024 11:06
Show Gist options
  • Save Caballerog/3cb64041872b67fee8135a7087ddc688 to your computer and use it in GitHub Desktop.
Save Caballerog/3cb64041872b67fee8135a7087ddc688 to your computer and use it in GitHub Desktop.
import { Ingredient } from "./ingredient";
import { Recipe } from "./recipe";
const ingredient1 = new Ingredient("Flour", "2 cups");
const ingredient2 = new Ingredient("Eggs", "3");
const recipe = new Recipe("Cake");
recipe.addIngredient(ingredient1);
recipe.addIngredient(ingredient2);
const ingredient3 = new Ingredient("Milk", "1 cup");
const compositeRecipe = new Recipe("Cake with Milk");
compositeRecipe.addRecipe(recipe);
compositeRecipe.addIngredient(ingredient3);
console.log(compositeRecipe.showDetails());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment