Class Cart
public class Cart
extends java.lang.Object
Constructor Summary
Constructor and Description |
---|
Cart() |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
addItem(CartItem newItem) |
java.util.ArrayList<CartItem> |
getCartItems() |
int |
getItemsCount() |
java.math.BigDecimal |
getTotal()
Calculate the total price for all items in the cart.
|
boolean |
validate()
Validate cart items.
|
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
Cart
public Cart()
Method Detail
addItem
public void addItem(CartItem newItem)
getCartItems
public java.util.ArrayList<CartItem> getCartItems()
getTotal
public java.math.BigDecimal getTotal()
- Returns:
- the total cart price
getItemsCount
public int getItemsCount()
validate
public boolean validate() throws IPCException
- Returns:
- true if the cart has items
- Throws:
IPCException
- if there are no items in the cart