FileDocCategorySizeDatePackage
ShoppingCartBean.javaAPI DocJBoss 4.2.12054Fri Jul 13 20:54:44 BST 2007org.jboss.tutorial.injection.bean

ShoppingCartBean

public class ShoppingCartBean extends Object implements ShoppingCart, Serializable

Fields Summary
private HashMap
cart
private Calculator
calculator
private Calculator
set
Constructors Summary
Methods Summary
public voidbuy(java.lang.String product, int quantity)

      if (cart.containsKey(product))
      {
         int currq = cart.get(product);
         currq = calculator.add(currq, quantity);
         cart.put(product, currq);
      }
      else
      {
         cart.put(product, quantity);
      }
   
public voidcheckout()

      System.out.println("To be implemented");
   
public java.util.HashMapgetCartContents()

      return cart;
   
public voidsetCalculator(Calculator c)

      set = c;