static void Main(string[] args)
        {
            // Creo un estante
            Estante estante = new Estante(3, 1);
            // Creo 4 productos
            Producto p1 = new Producto("Pepsi", "PESDS97413", (float)10.5);
            Producto p2 = new Producto("Coca-Cola", "COSDS55752", (float)10.5);
            Producto p3 = new Producto("Manaos", "MASDS51292", (float)10.5);
            Producto p4 = new Producto("Crush", "CRSDS54861", (float)10.5);

            // Agrego los productos al estante
            if (estante + p1)
            {
                Console.WriteLine("Agregó {0} {1} {2}", p1.GetMarca(), (string)p1, p1.GetPrecio());
            }
            else
            {
                Console.WriteLine("¡NO agregó {0} {1} {2}!", p1.GetMarca(), (string)p1, p1.GetPrecio());
            }
            if (estante + p1)
            {
                Console.WriteLine("Agregó {0} {1} {2}", p1.GetMarca(), (string)p1, p1.GetPrecio());
            }
            else
            {
                Console.WriteLine("¡NO agregó {0} {1} {2}!", p1.GetMarca(), (string)p1, p1.GetPrecio());
            }
            if (estante + p2)
            {
                Console.WriteLine("Agregó {0} {1} {2}", p2.GetMarca(), (string)p2, p2.GetPrecio());
            }
            else
            {
                Console.WriteLine("¡NO agregó {0} {1} {2}!", p2.GetMarca(), (string)p2, p2.GetPrecio());
            }
            if (estante + p3)
            {
                Console.WriteLine("Agregó {0} {1} {2}", p3.GetMarca(), (string)p3, p3.GetPrecio());
            }
            else
            {
                Console.WriteLine("¡NO agregó {0} {1} {2}!", p3.GetMarca(), (string)p3, p3.GetPrecio());
            }
            if (estante + p4)
            {
                Console.WriteLine("Agregó {0} {1} {2}", p4.GetMarca(), (string)p4, p4.GetPrecio());
            }
            else
            {
                Console.WriteLine("¡NO agregó {0} {1} {2}!", p4.GetMarca(), (string)p4, p4.GetPrecio());
            }
            // Muestro todo el estante
            Console.WriteLine();
            Console.WriteLine("<------------------------------------------------->");
            Console.WriteLine(Estante.MostrarEstante(estante));
            Console.ReadKey();
        }
Exemple #2
0
 static void Main(string[] args)
 {
     // Creo un estante
     Estante estante = new Estante(3, 1);
     // Creo 4 productos
     Producto p1 = new Producto("Pepsi", "PESDS97413", (float)18.5);
     Producto p2 = new Producto("Coca-Cola", "COSDS55752", (float)11.5);
     Producto p3 = new Producto("Manaos", "MASDS51292", (float)20.5);
     Producto p4 = new Producto("Crush", "CRSDS54861", (float)10.75);
 }
        public static string MostrarEstante(Estante e)
        {
            StringBuilder cadena = new StringBuilder();

            cadena.AppendLine("Ubicacion del Estante: " + e.ubicacionEstante);
            for (int i = 0; i < e.productos.Length; i++)
            {
                cadena.Append(i + 1 + "º Producto ");
                cadena.AppendLine("");
                cadena.AppendLine(Producto.MostrarProducto(e.productos[i]));
            }
            return(cadena.ToString());
        }
Exemple #4
0
        public static string MostrarEstante(Estante e)
        {
            int    i;
            string aux = "";

            for (i = 0; i < e._productos.Length; i++)
            {
                if (!Object.ReferenceEquals(e._productos[i], null))
                {
                    aux += Producto.MostrarProducto(e._productos[i]) + "\n";
                }
            }
            return("Estanteria: " + e._ubicacionEstante.ToString() + "\nCon los productos:\n" + aux);
        }
Exemple #5
0
        public string MostarEstante(Estante e)
        {
            StringBuilder detalleEstante = new StringBuilder();
            int           i = 0;

            detalleEstante.AppendFormat("Ubicacion: {0}\n", this.ubicacionEstante);

            for (i = 0; i < e.producto.Length; i++)
            {
                detalleEstante.AppendFormat(e.producto[i].MostrarProducto(e.producto[i]));
            }

            return(detalleEstante.ToString());
        }
Exemple #6
0
        /// <summary>
        /// Show Estante with all product
        /// </summary>
        /// <param name="e">estante</param>
        /// <returns>string with all information</returns>
        public static string MostrarEstante(Estante e)
        {
            StringBuilder infoEstante = new StringBuilder();
            string        returnInfo;

            infoEstante.AppendFormat("Estante {0}\n", e._ubicacionEstante);
            foreach (Producto producto in e.GetProductos())
            {
                if (!(Object.ReferenceEquals(producto, null)))
                {
                    infoEstante.AppendLine(Producto.MostrarProducto(producto));
                }
            }
            returnInfo = infoEstante.ToString();
            return(returnInfo);
        }