edu.uci.ics.inf111.dvdvendor.app
Class CheckOutCart

java.lang.Object
  extended by edu.uci.ics.inf111.dvdvendor.app.CheckOutCart

public class CheckOutCart
extends java.lang.Object

The CheckOutCart class stores a Vector of Products which the customer has added so far in the transaction.


Field Summary
private  java.util.Vector<Product> items
          A Vector of Products.
private  double totalCost
          The cost of the items in the cart
 
Constructor Summary
CheckOutCart()
          Creates a new CheckOutCart with an empty item list and 0 cost.
 
Method Summary
 void addItemToCart(Product newItem)
          Add a single item to the cart, and add its cost to the running totals.
 double getTotalCost()
          Accessor method which returns the cost of the items in the cart.
 java.util.Enumeration<Product> listItems()
          This method returns an enumeration of the Products in the cart.
 Product lookUpItem(Product item)
          This method looks up a product in the CheckOutCart.
 void setTotalCost(double totalCost)
          Accessor method which sets the cost of the items in the cart.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

items

private java.util.Vector<Product> items
A Vector of Products.


totalCost

private double totalCost
The cost of the items in the cart

Constructor Detail

CheckOutCart

public CheckOutCart()
Creates a new CheckOutCart with an empty item list and 0 cost.

Method Detail

setTotalCost

public void setTotalCost(double totalCost)
Accessor method which sets the cost of the items in the cart.


getTotalCost

public double getTotalCost()
Accessor method which returns the cost of the items in the cart.


addItemToCart

public void addItemToCart(Product newItem)
Add a single item to the cart, and add its cost to the running totals.

Parameters:
newItem -

lookUpItem

public Product lookUpItem(Product item)
This method looks up a product in the CheckOutCart.

Parameters:
item - The item that represents the product.
Returns:
The Product object of the found product, or null if no such product in the CheckOutCart.

listItems

public java.util.Enumeration<Product> listItems()
This method returns an enumeration of the Products in the cart. We do not return the Vector since we don't want external code to alter our cart.