|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch7.catalog.ShoppingCart<Item>
public class ShoppingCart<Item>
The bean for the shopping cart. The bean is generic: it does not matter what the actual data is. The shopping cart defines the operations that can be performed on the list of items that it stores.
Constructor Summary | |
---|---|
ShoppingCart()
Creates a new instance of ShoppingCart. |
Method Summary | |
---|---|
void |
addItem(Item item)
Mutator for the items element. |
void |
addTotal(double amount)
Mutator for the total element. |
int |
getCount()
Accessor for the count element. |
java.util.List<Item> |
getItems()
Accessor for the items element. |
double |
getTotal()
Accessor for the total element. |
java.lang.String |
getTotalAsCurrency()
Accessor for the total element, formatted as currency. |
void |
incrCount()
Mutator for the count element. |
void |
resetItems()
Resets the shopping cart so that it is empty. |
void |
setCount(int count)
Mutator for the count element. |
void |
setItems(java.util.List<Item> items)
Mutator for the items element. |
void |
setTotal(double total)
Mutator for the total element. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ShoppingCart()
Method Detail |
---|
public void resetItems()
public void setItems(java.util.List<Item> items)
items
- The new value to store in the items.public java.util.List<Item> getItems()
public void addItem(Item item)
item
- Added to the list of items.public void setTotal(double total)
total
- The new value to store in the total.public double getTotal()
public void setCount(int count)
count
- The new value to store in the count.public int getCount()
public void addTotal(double amount)
amount
- Added to the current total.public java.lang.String getTotalAsCurrency()
public void incrCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |