Class Cart

java.lang.Object
edu.ntnu.stud.model.Cart

public class Cart extends Object
The Cart class is responsible for managing the user's shopping cart. It works in conjunction with the ShoppingList class?
  • Constructor Details

    • Cart

      public Cart()
  • Method Details

    • addRecipeToCart

      public static void addRecipeToCart(String recName)
      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

      public static List<Ingredient> getCart()
      Returns the list of ingredients in the cart.
      Returns:
      The list of ingredients in the cart