public static boolean getProduct(String code) { boolean isFound = false; Product tempProduct = new Product(); tempProduct = ProductDB.getProduct(code); if (tempProduct.getCode() != null) isFound = true; return isFound; }
/** * Adds the specified quantity of the product with the specified code to the cart. * * @param upc the code of the product to add. * @param quantity the quantity to add. * @throws BadUPCException if the code doesn't belong to any product. * @throws BadQuantityException if the quantity is less than 0. */ public void addItem(UPC upc, int quantity) throws BadUPCException, BadQuantityException { if (quantity < 0) { throw new BadQuantityException(); } if (quantity > 0) { cart.addMoney( new Money( db.getPrice(upc).getPrice().multiply(new BigDecimal(quantity)), db.getPrice(upc).getCurrency())); } }
public boolean isExist(String code) { return productDB.isItemExist(code); }