Exemplo n.º 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());
        }
Exemplo n.º 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());
        }
Exemplo n.º 3
0
        private string MostrarGalletita(Galletita g)
        {
            StringBuilder s = new StringBuilder();

            s.AppendFormat("GALLETITA\n{0}\nPESO: {1}\n", (string)this, this.peso);
            return(s.ToString());
        }
        private static string MostrarGalletita(Galletita g)
        {
            string cadena = g;

            cadena += string.Format("\nPeso {0}\n", g._peso);
            return(cadena);
        }
Exemplo n.º 5
0
        private static string  MostrarGalletita(Galletita g)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("MARCA: {0}\nCODIGO: {1}\nPRECIO: {2}\nPESO: {3}\n\n", g.Marca, g._codigoBarra, g.Precio, g._peso);
            return(sb.ToString());
        }
Exemplo n.º 6
0
        public static string MostrarGalletita(Galletita galleta)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("Peso: " + galleta._peso);

            return(Producto.MostrarProducto(galleta) + sb.ToString());
        }
Exemplo n.º 7
0
        private static string MostrarGalletita(Galletita g)
        {
            StringBuilder retorno = new StringBuilder();

            retorno.AppendLine(g);
            retorno.AppendLine("Peso " + g._peso);
            return(retorno.ToString());
        }
Exemplo n.º 8
0
        /// <summary>
        /// Guarda los datos de la galletita(incluidos los de la clase base) en un string,
        /// </summary>
        /// <returns>string</returns>
        private string MostrarGalletita(Galletita g)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(this);
            sb.AppendLine("PESO: " + this._peso);

            return(sb.ToString());
        }
        public static string MostrarGalletita(Galletita galletita)
        {
            StringBuilder SB = new StringBuilder();

            SB.AppendLine(Producto.MostrarProducto(galletita));
            SB.AppendLine("Peso: " + galletita._peso);

            return(SB.ToString());
        }
        private string MostrarGalletita(Galletita g)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("\n{0}", (string)g);
            sb.AppendFormat("\nPESO: {0}", g._peso);

            return(sb.ToString());
        }
Exemplo n.º 11
0
        private static string MostrarGalletita(Galletita galletita)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(galletita + "Peso de la galleta   " + galletita._peso);
            //sb.AppendLine("Peso de la galleta   " + galletita._peso);

            return(sb.ToString());
        }
Exemplo n.º 12
0
        /// <summary>
        /// Devuelve un string con los datos de la galletita
        /// </summary>
        /// <param name="g"></param>
        /// <returns></returns>
        private string MostrarGalletita(Galletita g)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("MARCA: " + g.Marca);
            sb.AppendLine("CODIGO DE BARRAS: " + g._codigoBarra);
            sb.AppendLine("PRECIO: " + g.Precio);
            sb.AppendLine("PESO: " + g._peso);

            return(sb.ToString());
        }
Exemplo n.º 13
0
        public float GetValorEstante(Producto.ETipoProducto tipo)
        {
            float producto = 0;

            foreach (Producto item in this._productos)
            {
                switch (tipo)
                {
                case Producto.ETipoProducto.Galletita:
                    if (item is Galletita)
                    {
                        Galletita g = (Galletita)item;
                        producto += g.Precio;
                    }

                    break;

                case Producto.ETipoProducto.Gaseosa:
                    if (item is Gaseosa)
                    {
                        Gaseosa g = (Gaseosa)item;
                        producto += g.Precio;
                    }

                    break;

                case Producto.ETipoProducto.Jugo:
                    if (item is Jugo)
                    {
                        Jugo j = (Jugo)item;
                        producto += j.Precio;
                    }

                    break;

                case Producto.ETipoProducto.Harina:
                    if (item is Harina)
                    {
                        Harina h = (Harina)item;
                        producto += h.Precio;
                    }

                    break;

                case Producto.ETipoProducto.Todos:
                    producto += item.Precio;
                    break;
                }
            }
            return(producto);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Devuelve una cadena con los datos de galletita
        /// </summary>
        /// <param name="g"></param>
        /// <returns></returns>
        private string MostrarGalletita(Galletita g)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("MARCA: ");
            sb.AppendLine((g.Marca).ToString());
            sb.Append("C\u00f3DIGO DE BARRAS: ");
            sb.AppendLine((g._codigoBarra).ToString());
            sb.Append("PRECIO: ");
            sb.AppendLine((g.Precio).ToString());
            sb.Append("PESO: ");
            sb.AppendLine(this._peso.ToString());
            sb.AppendLine();
            return(sb.ToString());
        }
Exemplo n.º 15
0
        public static Estante operator -(Estante e, Producto.ETipoProducto tipo)
        {
            for (int i = 0; i < e.GetProductos().Count; i++)
            {
                switch (tipo)
                {
                case Producto.ETipoProducto.Galletita:
                    if (e.GetProductos()[i] is Galletita)
                    {
                        Galletita g = (Galletita)e.GetProductos()[i];
                        e -= g;
                    }
                    break;

                case Producto.ETipoProducto.Gaseosa:
                    if (e.GetProductos()[i] is Gaseosa)
                    {
                        Gaseosa g = (Gaseosa)e.GetProductos()[i];
                        e -= g;
                    }
                    break;

                case Producto.ETipoProducto.Jugo:
                    if (e.GetProductos()[i] is Jugo)
                    {
                        Jugo j = (Jugo)e.GetProductos()[i];
                        e -= j;
                    }
                    break;

                case Producto.ETipoProducto.Harina:
                    if (e.GetProductos()[i] is Harina)
                    {
                        Harina h = (Harina)e.GetProductos()[i];
                        e -= h;
                    }
                    break;

                case Producto.ETipoProducto.Todos:
                    e -= e.GetProductos()[i];
                    break;
                }
            }
            return(e);
        }
Exemplo n.º 16
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());
        }
Exemplo n.º 17
0
 public override string ToString(Galletita g)
 {
     return(this.MostrarGalletita(g));
 }
Exemplo n.º 18
0
 public string MostrarGalletita(Galletita g)
 {
     return(string.Format("Sabor: {0}", g.sabor.ToString()));
 }
Exemplo n.º 19
0
 public static string MostrarGalletita(Galletita galleta)
 {
     return(Producto.MostrarProducto(galleta) + " " + galleta._peso);
 }
Exemplo n.º 20
0
 private static string MostrarGalletita(Galletita g)
 {
     return((string)g + "PESO: " + g._peso + "\n");
 }
Exemplo n.º 21
0
 public override string ToString()
 {
     return(Galletita.MostrarGalletita(this));
 }
Exemplo n.º 22
0
 private static string MostrarGalletita(Galletita galletita)
 {
     return(((Producto)galletita) + " peso " + galletita._peso.ToString());
 }
Exemplo n.º 23
0
 private static string MostrarGalletita(Galletita G)
 {
     return("Codigo Barra: " + G._codBarra.ToString() + "\nMarca: " + G._marcas.ToString() + "\nPrecio: " + G._precio.ToString() + "\nPeso: " + G._peso.ToString() + "\n\n");
 }
Exemplo n.º 24
0
 private static string MostrarGalletita(Galletita g)
 {
     return(string.Format("Peso: {0}", g.peso.ToString()));
 }
Exemplo n.º 25
0
 private static string MostrarGalletita(Galletita g)
 {
     return((Producto)g + g._precio.ToString());
 }