Class ShoppingCart

java.lang.Object
  extended byShoppingCart

public class ShoppingCart
extends Object

A ShoppingCart keeps track of a customer's purchases.

Version:
1
See Also:
EStore

Constructor Summary
ShoppingCart()
          Construct a new empty ShoppingCart.
 
Method Summary
 void add(Item purchase)
          When this ShoppingCart is asked to add an Item to itself it updates its count field and then updates its cost field by sending the Item a getCost message.
 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.
 
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

add

public void add(Item purchase)
When this ShoppingCart is asked to add an Item to itself it updates its count field and then updates its cost field by sending the Item a getCost message.

Parameters:
purchase - the Item being added to this ShoppingCart.

getCost

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

Returns:
the total cost.

getCount

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

Returns:
the count of Items.