Class ShoppingCart

java.lang.Object
  |
  +--ShoppingCart

public class ShoppingCart
extends Object

A ShoppingCart keeps track of a customer's purchases.

Version:
4
See Also:
EStore

Constructor Summary
ShoppingCart()
          Construct a new empty ShoppingCart.
 
Method Summary
 void addItem(Item item)
          Add an Item to this ShoppingCart.
 int getCost()
          What happens when this ShoppingCart is asked the total cost of the Items it contains.
 int getCount()
          What happens when this ShoppingCart is asked how many Items it contains.
 void returnItem(Item item)
          Return an Item from this ShoppingCart.
 void showContents(Terminal t)
          Write the contents of this ShoppingCart to a Terminal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShoppingCart

public ShoppingCart()
Construct a new empty ShoppingCart.

Method Detail

addItem

public void addItem(Item item)
Add an Item to this ShoppingCart.

Parameters:
item - the Item to add.

getCost

public int getCost()
What happens when this ShoppingCart is asked the total cost of the Items it contains.

Returns:
the total cost of the items in this ShoppingCart.

getCount

public int getCount()
What happens when this ShoppingCart is asked how many Items it contains.

Returns:
the number of items in this ShoppingCart.

returnItem

public void returnItem(Item item)
Return an Item from this ShoppingCart.

Parameters:
item - the Item to return.

showContents

public void showContents(Terminal t)
Write the contents of this ShoppingCart to a Terminal.

Parameters:
t - the Terminal to use for output.