Пример #1
0
        public bool agregarPasajero(Pasajero pas1)
        {
            bool rta = true;

            foreach (Pasajero recorre in this._listaDePasajeros)
            {
                if (recorre == pas1)
                {
                    Console.WriteLine("Ya se encuentra el pasajero");
                    rta = false;
                }
                else
                {
                    if (this.cantidadpasajeros < this._CantMax)
                    {
                        this._listaDePasajeros.Add(pas1);
                        rta = true;;
                    }
                    else
                    {
                        Console.WriteLine("No hay capacidad");
                        rta = false;
                    }
                }
            }
            return(rta);
        }
Пример #2
0
        static void Main(string[] args)
        {
            Vuelo    unVuelo    = new Vuelo(DateTime.Today, "GREGORIO SA", 15000, 50);
            Pasajero unPasajero = new Pasajero(true, "Perez", "37654238", "Carlos");

            unVuelo.agregarPasajero(unPasajero);

            decimal montoTotalVuelo = unVuelo;
        }