/// <summary> /// SOBRECARGA, Muestra el total facturado de cierto tipo de vehiculos /// </summary> /// <param name="vhc"></param> /// <returns></returns> public double MostrarTotalFacturado(eVehiculos vhc) { double ganAuto = 0; double ganCamio = 0; double ganMoto = 0; double ganTotal = 0; foreach (Vehiculo item in this.vehiculo) { if (item is Moto) { ganMoto += this.precioMoto; } if (item is Camion) { ganCamio += this.precioCamion; //ganTotal += this.precioMoto; } if (item is Auto) { ganAuto += this.precioAuto; } } //ganTotal = ganMoto + ganCamio + ganAuto; switch (vhc) { case eVehiculos.Moto: ganTotal = ganMoto; break; case eVehiculos.Camion: ganTotal = ganCamio; break; case eVehiculos.Auto: ganTotal = ganAuto; break; } return(ganTotal); }
public double MostrarTotalFacturado(eVehiculos vehiculo) { double precioTotal = 0; switch (vehiculo) { case eVehiculos.Auto: foreach (Vehiculo item in this.vehiculos) { if (item is Auto) { precioTotal += this.precioAuto; } } break; case eVehiculos.Moto: foreach (Vehiculo item in this.vehiculos) { if (item is Moto) { precioTotal += this.precioMoto; } } break; case eVehiculos.Camion: foreach (Vehiculo item in this.vehiculos) { if (item is Camion) { precioTotal += this.precioCamion; } } break; default: break; } return(precioTotal); }