/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package cobain; import java.util.*; /** * * @author Administrator */ public class Keranjang { private Vector _items = new Vector(); public void addItem(Barang item) { _items.add(item); } public void removeItem(Barang item) { _items.remove(item); } public void empty() { _items.clear(); } public float totalHarga() { float total = 0; for(Object i:_items) { Barang b = (Barang)i; total += b.getHarga(); } return total; } public int totalItem() { return _items.size(); } }