Ejemplo n.º 1
0
        public static string MostrarGalletita(Galletita galleta)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(Producto.MostrarProducto((Producto)galleta));   // (Producto) esta de mas. se castea solo
            sb.AppendLine(galleta._peso.ToString());
            return(sb.ToString());
        }
Ejemplo n.º 2
0
        public static string MostrarEstante(Estante est)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Capacidad del estante: " + est._capacidad);

            foreach (var item in est._productos)
            {
                if (item is Gaseosa)
                {
                    sb.AppendLine(((Gaseosa)item).MostrarGaseosa());
                }
                else if (item is Galletita)
                {
                    sb.AppendLine(Galletita.MostrarGalletita((Galletita)item));
                }
                else if (item is Jugo)
                {
                    sb.AppendLine(((Jugo)item).MostrarJugo());
                }
            }

            return(sb.ToString());
        }