Package edu.ntnu.stud.model
Class Cart
java.lang.Object
edu.ntnu.stud.model.Cart
The Cart class is responsible for managing the user's shopping cart.
It works in conjunction with the ShoppingList class?
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addRecipeToCart
(String recName) Adds a recipe to the cart by reading the recipe from cookbook.json and adding it to cart.json.static void
Clears the cart by removing all items from the cart list and cart.json.static List
<Ingredient> getCart()
Returns the list of ingredients in the cart.
-
Constructor Details
-
Cart
public Cart()
-
-
Method Details
-
addRecipeToCart
Adds a recipe to the cart by reading the recipe from cookbook.json and adding it to cart.json.- Parameters:
recName
- The name of the recipe to add to the cart
-
clearCart
public static void clearCart()Clears the cart by removing all items from the cart list and cart.json. -
getCart
Returns the list of ingredients in the cart.- Returns:
- The list of ingredients in the cart
-