Exemplo n.º 1
0
        public double GetTotal()
        {
            var total = 0.0;
            int i     = 0;

            foreach (var producto in Productos)
            {
                total += producto.Precio * CantidadDeProducto.Get(i).IntValue;
                i++;
            }
            return(total);
        }
Exemplo n.º 2
0
        public void AddProducto(Producto producto, int cantidad)
        {
            int i = 0;

            foreach (var p in Productos)
            {
                if (p.Equals(producto))
                {
                    CantidadDeProducto.Get(i).IntValue += cantidad;
                    return;
                }
                i++;
            }
            Productos.AddLast(producto);
            CantidadDeProducto.AddLast(new IntWrapper(cantidad));
        }