Class Cart

java.lang.Object
com.jahnreil_stratpoint.model.Cart

public class Cart extends Object
The Cart class represents a shopping cart that holds multiple CartItems. It provides methods to add and remove items from the cart. The Cart can be constructed with all arguments or with no arguments.
  • Constructor Details

    • Cart

      public Cart()
  • Method Details

    • addCarItem

      public Cart addCarItem(CartItem cartItem, Cart cart)
      Adds a CartItem to the cart.
      Parameters:
      cartItem - the cart item to be added
      cart - the cart to which the item is added
      Returns:
      the updated cart with the new item added
    • removeCartItem

      public Cart removeCartItem(CartItem cartItem, Cart cart)
      Removes a CartItem from the cart.
      Parameters:
      cartItem - the cart item to be removed
      cart - the cart from which the item is removed
      Returns:
      the updated cart with the item removed