Class CartController

java.lang.Object
com.jahnreil_stratpoint.controller.CartController

public class CartController extends Object
Controller class for managing operations related to the shopping cart.
  • Constructor Details

    • CartController

      public CartController(Cart cart)
      Constructor to initialize the CartController with a cart instance.
      Parameters:
      cart - The cart instance to be managed by this controller.
  • Method Details

    • addToCart

      public Cart addToCart(Cart cart, ArrayList<Product> products)
      Adds a selected product to the shopping cart.
      Parameters:
      cart - The current cart instance.
      products - List of available products to choose from.
      Returns:
      Updated cart instance after adding the product.
    • viewCart

      public void viewCart(ArrayList<Product> products)
      Displays the contents of the shopping cart and handles user interactions.
      Parameters:
      products - List of available products for displaying cart items.