⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cartitem.java

📁 续购物车
💻 JAVA
字号:
package shopping.objectType;


/**
 * 顾客购买的每个商品,设计CartItem对象记录商品的购买情况
 * 购买的每个商品、购买的数量和该商品的小计金额
 * @author lijin
 */
public class CartItem {
	private Product product;
	private Integer quantity;
	private Double itemPrice;
	
	public void setProduct(Product product){
	   this.product=product;
	}
	public void setQuantity(Integer quantity){
		this.quantity=quantity;
	}
	public void setItemPrice(Double itemPrice){
		this.itemPrice=itemPrice;
	}
	public Product getProduct(){
		return product;
	}
	public Integer getQuantity(){
		return quantity;
	}
	/**
	 * 小计金额
	 * @return Double
	 */
	public Double getItemPrice(){
		double price=this.getProduct().getProductPrice().doubleValue()*
		             this.getQuantity().intValue();
		return new Double(price);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -