/* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * * You may not modify, use, reproduce, or distribute this software * except in compliance with the terms of the license at: * http://developer.sun.com/berkeley_license.html */ package cart; import entity.Product; /** * * @author tgiunipero */ public class ShoppingCartItem { Product product; short quantity; public ShoppingCartItem(Product product) { this.product = product; quantity = 1; } public Product getProduct() { return product; } public short getQuantity() { return quantity; } public void setQuantity(short quantity) { this.quantity = quantity; } public void incrementQuantity() { quantity++; } public void decrementQuantity() { quantity--; } public double getTotal() { double amount = 0; amount = (this.getQuantity() * product.getPrice().doubleValue()); return amount; } }