Package com.jahnreil_stratpoint.model
Class Cart
java.lang.Object
com.jahnreil_stratpoint.model.Cart
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddCarItem
(CartItem cartItem, Cart cart) Adds a CartItem to the cart.removeCartItem
(CartItem cartItem, Cart cart) Removes a CartItem from the cart.
-
Constructor Details
-
Cart
public Cart()
-
-
Method Details
-
addCarItem
Adds a CartItem to the cart.- Parameters:
cartItem
- the cart item to be addedcart
- the cart to which the item is added- Returns:
- the updated cart with the new item added
-
removeCartItem
Removes a CartItem from the cart.- Parameters:
cartItem
- the cart item to be removedcart
- the cart from which the item is removed- Returns:
- the updated cart with the item removed
-