Ejemplo n.º 1
0
 public FirstClassPassenger(int id, string firstName, string lastName, string phoneNumber, Ticket[] tickets, int luggageWeight, string mealMenu)
     : base(id, firstName, lastName, phoneNumber, tickets, luggageWeight)
 {
     this.mealMenu = mealMenu;
     this.UpdateBonus();
 }
Ejemplo n.º 2
0
 public EconomyPassenger(int id, string firstName, string lastName, string phoneNumber, Ticket[] tickets, int luggageWeight)
     : base(id, firstName, lastName, phoneNumber, tickets)
 {
     this.luggageWeight = luggageWeight;
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Flight[] flights = new Flight[2]
            {
                new Flight(1000, "Honduras", "Siberia", new DateTime(2016, 6, 10)),
                new Flight(2000, "Siberia", "Honduras", new DateTime(2016, 7, 10))
            };

            Ticket[] tickets = new Ticket[2]
            {
                new Ticket(1234, 7777, flights[0], 1000),
                new Ticket(4321, 8888, flights[1], 2000)
            };

            Passenger[] passengers = new Passenger[2]
            {
                new EconomyPassenger(7777, "John", "Doe", "555-55-55", tickets, 25),
                new FirstClassPassenger(8888, "Jane", "Doe", "555-55-66", tickets, 25, "Vegan")
            };

            Array.ForEach(flights, x => Console.WriteLine("\nFlight: " + x.ToString()));
            Array.ForEach(tickets, x => Console.WriteLine("\nTicket: " + x.ToString()));
            Array.ForEach(passengers, x => Console.WriteLine("\nPassenger: " + x.ToString()));

            Console.WriteLine("\nFlight Class - SearchFlight method");
            Console.WriteLine(Flight.SearchFlight(flights, 1000));
            Console.WriteLine("\nTicket Class - GetPrice method");
            Console.WriteLine(tickets[0].GetPrice(tickets[0].ticketID));
            Console.WriteLine("\nTicket Class - GetTicketInfo method");
            List<string> pInfo = new List<string>();
            pInfo = tickets[0].GetTicketInfo(passengers);
            foreach (string s in pInfo)
            {
                Console.WriteLine(s);
            }
            Console.WriteLine("\nEconomyPassenger Class - GetInfo method");
            foreach (Passenger p in passengers)
            {
                Console.WriteLine(p.GetInfo(7777));
            }
            Console.WriteLine("\nFirstClassPassenger Class - GetInfo method");
            foreach (Passenger p in passengers)
            {
                Console.WriteLine(p.GetInfo(8888));
            }
            Console.WriteLine("\nPassenger Class - GetTicketInfo method");
            List<string> tInfo = new List<string>();
            tInfo = passengers[0].GetTicketInfo();
            foreach (string s in tInfo)
            {
                Console.WriteLine(s);
            }

            Console.WriteLine("\nPress enter to close...");
            Console.ReadLine();
        }
Ejemplo n.º 4
0
 public Passenger(int id, string firstName, string lastName, string phoneNumber, Ticket[] tickets)
 {
     this.id = id;
     this.firstName = firstName;
     this.lastName = lastName;
     this.phoneNumber = phoneNumber;
     this.tickets = tickets;
 }