/*
 * Created on Sep 6, 2005
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package edu.uprm.ece.icom5016.bean;

import java.math.BigDecimal;

/**
 * @author elliot
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class ItemOrdered {
	private CatalogItem item;
	private int numItems;
	private BigDecimal total;
	
	public ItemOrdered(){
		
	}
	
	public ItemOrdered(CatalogItem item, int num){
		this.item = item;
		this.numItems = num;
		this.total = item.getPrice();
		this.total = this.total.multiply(new BigDecimal(Integer.toString(num)));
	}
	/**
	 * @return
	 */
	public CatalogItem getItem() {
		return item;
	}

	/**
	 * @return
	 */
	public int getNumItems() {
		return numItems;
	}

	/**
	 * @param item
	 */
	public void setItem(CatalogItem item) {
		this.item = item;
	}

	/**
	 * @param i
	 */
	public void setNumItems(int i) {
		numItems = i;
	}
	
	public void addItems(int i){
		numItems += i;
		this.total = this.total.add(this.item.getPrice().multiply(new BigDecimal(Integer.toString(i))));
	}

	/**
	 * @return
	 */
	public BigDecimal getTotal() {
		return total;
	}

}
