private double ObtenerPrecio(ELibro tipoLibro) { double retorno = 0; double contManuales = 0, contNovelas = 0; foreach (Libro item in this._libros) { if (item is Novela) { contNovelas += (Novela)item; } else if (item is Manual) { contManuales += (Manual)item; } } if (tipoLibro == ELibro.Manual) { retorno = contManuales; } else if (tipoLibro == ELibro.Novela) { retorno = contNovelas; } else { retorno = contNovelas + contManuales; } return(retorno); }
public double ObtenerPrecio(ELibro tipoLibro) { double retorno = 0; foreach (Libro libro in this._libros) { if (tipoLibro == ELibro.Manual && libro is Manual) { retorno += (Manual)libro; } else if (tipoLibro == ELibro.Novela && libro is Novela) { retorno += (Novela)libro; } else if (tipoLibro == ELibro.Ambos) { if (libro is Novela) { retorno += (Novela)libro; } else if (libro is Manual) { retorno += (Manual)libro; } } } return(retorno); }
private double ObtenerPrecio(ELibro tipoLibro) { double retorno = 0; foreach (Libro libroA in this._libros) { switch (tipoLibro) { case ELibro.Manual: if (libroA is Manual) { retorno += ((Manual)libroA); } break; case ELibro.Novela: if (libroA is Novela) { retorno += ((Novela)libroA); } break; default: break; } } return(retorno); }
private double ObtenerPrecio(ELibro tipoLibro) { double retorno = 0; foreach (Libro libro in this.libros) { if (libro is Manual && tipoLibro == ELibro.PrecioDeManuales) { retorno += (Single)(Manual)libro; } else if (libro is Novela && tipoLibro == ELibro.PrecioDeNovelas) { retorno += (Novela)libro; } else if (tipoLibro == ELibro.PrecioTotal) { if (libro is Manual) { retorno += (Single)(Manual)libro; } else if (libro is Novela) { retorno += (Novela)libro; } } } return(retorno); }
private double ObtenerPrecio(ELibro tipoLibro) { double precio = 0; switch (tipoLibro) { case ELibro.PrecioDeManuales: foreach (Libro l in this.libros) { if (l is Manual) { precio += (Single)(Manual)l; } } break; case ELibro.PrecioDeNovelas: foreach (Libro l in this.libros) { if (l is Novela) { precio += (Novela)l; } } break; case ELibro.PrecioTotal: foreach (Libro l in this.libros) { if (l is Manual) { precio += (Single)(Manual)l; } } foreach (Libro l in this.libros) { if (l is Novela) { precio += (Novela)l; } } break; } return(precio); }
private double ObtenerPrecio(ELibro tipoLibro) { if (tipoLibro == ELibro.Manual) { return(PrecioDeManuales); } else if (tipoLibro == ELibro.Novela) { return(PrecioDeNovelas); } else { return(PrecioTotal); } }
private double ObtenerPrecio(ELibro tipoLibro) { double acum = 0; foreach (Libro l in this._libros) { if ((ELibro)tipoLibro == ELibro.Novela && l is Novela) { acum += ((double)((Novela)l)); } if ((ELibro)tipoLibro == ELibro.Manual && l is Manual) { acum += ((double)((Manual)l)); } } return(acum); }
double ObtenerPrecio(ELibro tipoLibro) { double retorno = 0; int contmanual = 0; int contnovela = 0; foreach (Libro item in this._libros) { if (item is Manual) { contmanual++; } else if (item is Novela) { contnovela++; } } switch (tipoLibro) { case ELibro.Manual: { retorno = contmanual * PrecioDeManual; } break; case ELibro.Novela: { retorno = contnovela * PrecioDeNovelas; } break; case ELibro.Ambos: { retorno = (contmanual + contnovela) * PrecioTotal; } break; default: break; } return(retorno); }
private double ObtenerPrecio(ELibro tipoLibro) { double retorno = 0; switch (tipoLibro) { case ELibro.Manual: retorno = this.PrecioDeManuales; break; case ELibro.Novela: retorno = this.PrecioDeNovelas; break; case ELibro.Ambos: retorno = this.PrecioTotal; break; } return(retorno); }
private double ObtenerPrecio(ELibro tipoLibro) { double precio = 0; if (tipoLibro == ELibro.Manual) { precio = this.PrecioDeManuales; } else if (tipoLibro == ELibro.Novela) { precio = this.PrecioDeNovelas; } else { precio = this.PrecioTotal; } return(precio); }
private double ObtenerPrecio(ELibro tipolibro) { double acum = 0; foreach (Libro item in this._libros) { switch (tipolibro) { case ELibro.Novela: if (item is Novela) { acum += ((Novela)item); } break; case ELibro.Manual: if (item is Manual) { acum += ((Manual)item); } break; default: if (item is Manual) { acum += ((Manual)item); } if (item is Novela) { acum += ((Novela)item); } break; } } return(acum); }
private double ObtenerPrecio(ELibro tipoLibro) { double retorno = 0; foreach (Libro item in this._libros) { switch (tipoLibro) { case ELibro.Manual: if (item is Manual) { retorno += ((Manual)item); } break; case ELibro.Novela: if (item is Novela) { retorno += ((Novela)item); } break; case ELibro.Ambos: if (item is Novela) { retorno += ((Novela)item); } else if (item is Manual) { retorno += ((Manual)item); } break; default: break; } } return(retorno); }
private double ObtenerPrecio(ELibro tipoLibro) { double acum = 0; switch (tipoLibro) { case ELibro.Manual: foreach (Libro l in this._libros) { if (l is Manual) { acum += ((Manual)l); } } break; case ELibro.Novela: foreach (Libro l in this._libros) { if (l is Novela) { acum += ((Novela)l); } } break; case ELibro.Ambos: foreach (Libro l in this._libros) { if (l is Manual && l is Novela) { acum += ((Novela)l); } } break; } return(acum); }
private double ObtenerPrecio(ELibro tipoLibro) { double precio = 0; switch (tipoLibro) { case ELibro.Manual: foreach (Libro lib in this._libros) { if (lib is Manual) { precio += ((Manual)lib); } } break; case ELibro.Novela: foreach (Libro lib in this._libros) { if (lib is Novela) { precio += ((Novela)lib); } } break; case ELibro.Ambos: foreach (Libro lib in this._libros) { if (lib is Novela && lib is Manual) { precio += ((Novela)lib); } } break; } return(precio); }
/// <summary> /// Obitene el precio de libros dentro de Biblioteca que correspondan al tipo por parametro /// </summary> /// <param name="tipoLibro"></param> /// <returns></returns> private double ObtenerPrecio(ELibro tipoLibro) { switch (tipoLibro) { case ELibro.PrecioDeManuales: { return(this.PrecioDeManuales); } case ELibro.PrecioDeNovelas: { return(this.PrecioDeNovelas); } case ELibro.PrecioTotal: { return(this.PrecioTotal); } default: return(0); } }
private double ObtenerPrecio(ELibro tipoLibro) { double precioTotal = 0; double precioManual = 0; double precioNovela = 0; foreach (Libro item in this._libros) { if (item is Manual) { precioManual += (Manual)item; } else if (item is Novela) { precioNovela += (Novela)item; } } switch (tipoLibro) { case ELibro.Manual: precioTotal = precioManual; break; case ELibro.Novela: precioTotal = precioNovela; break; case ELibro.Ambos: precioTotal = precioNovela + precioManual; break; } return(precioTotal); }
private double ObtenerPrecio(ELibro tipo) { double retorno = 0; double sumaManuales = 0; double sumaNovelas = 0; foreach (Libro item in this._libros) { if (item is Manual) { sumaManuales += (Manual)item; } if (item is Novela) { sumaNovelas += (Novela)item; } } switch (tipo) { case ELibro.Manual: retorno = sumaManuales; break; case ELibro.Novela: retorno = sumaNovelas; break; case ELibro.Ambos: retorno = sumaManuales + sumaNovelas; break; default: break; } return(retorno); }
private double ObtenerPrecio(ELibro tipoLibro) { double precio = 0; foreach (Libro item in this._libros) { switch (tipoLibro) { case ELibro.Manual: if (item is Manual) { precio += (Manual)item; } break; case ELibro.Novela: if (item is Novela) { precio += (Novela)item; } break; case ELibro.Ambos: if (item is Novela) { precio += (Novela)item; } else if (item is Manual) { precio += (Manual)item; } break; } } return(precio); }
protected double ObtenerPrecio(ELibro tipolibro) { double retorno = 0; double totalManuales = 0; double totalNovelas = 0; foreach (Libro lib in this._libros) { if (lib is Novela) { totalNovelas += (Novela)lib; } if (lib is Manual) { totalManuales += (Manual)lib; } } switch (tipolibro) { case ELibro.Novela: retorno = totalNovelas; break; case ELibro.Manual: retorno = totalManuales; break; case ELibro.Ambos: retorno = totalManuales + totalNovelas; break; } return(retorno); }
private double ObtenerPrecio(ELibro tipoLibro) { return(precioTotal); }