public class ShoppingCart
extends java.lang.Object
Constructor and Description |
---|
ShoppingCart() |
Modifier and Type | Method and Description |
---|---|
void |
addItem(Item item)
Adds an item to the cart
|
java.util.ArrayList<Item> |
getItems() |
float |
getTotalCost() |
void |
removeItem(int anId)
Removes the item in the selected position
Returns a diagnostic message in case of wrong item
|
void |
showDetails()
Displays the details of each item in the
cart in the console.
|
public void addItem(Item item)
item:
- item for additionpublic void removeItem(int anId)
anId:
- id of the item for deletionpublic float getTotalCost()
public java.util.ArrayList<Item> getItems()
public void showDetails()