Example #1
0
        public static string MostrarEstante(Estante est)
        {
            Galletita auxGalletita;
            Gaseosa   auxGaseosa;
            Jugo      auxJugo;

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Contenido estante:");
            sb.AppendLine("Capacidad: " + est._capacidad);
            sb.AppendLine("Listado de productos:");

            foreach (Producto item in est.GetProductos())
            {
                if (item is Galletita)
                {
                    auxGalletita = (Galletita)item;
                    sb.AppendLine(Galletita.MostrarGalletita(auxGalletita));
                }
                else if (item is Gaseosa)
                {
                    auxGaseosa = (Gaseosa)item;
                    sb.AppendLine(auxGaseosa.MostrarGaseosa());
                }
                else if (item is Jugo)
                {
                    auxJugo = (Jugo)item;
                    sb.AppendLine(auxJugo.MostrarJugo());
                }
            }
            return(sb.ToString());
        }
Example #2
0
        public static string MostrarEstante(Estante est)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("Capacidad: " + est._capacidad);
            builder.Append("Listado de Productos");

            foreach (Producto item in est._productos)
            {
                if (item is Galletita)
                {
                    builder.AppendLine(Galletita.MostrarGalletita(((Galletita)item)));
                }

                if (item is Jugo)
                {
                    builder.AppendLine(((Jugo)item).MostrarJugo());
                }

                if (item is Gaseosa)
                {
                    builder.AppendLine(((Gaseosa)item).MostrarGaseosa());
                }
            }

            return(builder.ToString());
        }
Example #3
0
        public static string MostrarEstante(Estante est)
        {
            StringBuilder sb = new StringBuilder();

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

            return(sb.ToString());
        }
Example #4
0
 public override string ToString()
 {
     return(Galletita.MostrarGalletita(this));
 }