示例#1
0
        public static void Main()
        {
            Random         rand  = new Random();
            PassengerQueue queue = new PassengerQueue();
            int            N     = rand.Next(4, 20);

            for (int i = 0; i < N; i++)
            {
                int x = rand.Next(0, 3);
                if (x == 1)
                {
                    queue.AddToQueue(new PassengerWithChildren()
                    {
                        Name = rand.Next(1000, 9999).ToString(), LastName = rand.Next(10000, 99999).ToString(), Age = rand.Next(30, 90), NumberOfChildren = rand.Next(1, 5)
                    });
                }
                else
                {
                    queue.AddToQueue(new Passenger()
                    {
                        Name = rand.Next(1000, 9999).ToString(), LastName = rand.Next(10000, 99999).ToString(), Age = rand.Next(30, 90)
                    });
                }
                queue.StartServingQueue();
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            PassengerQueue passengerQueue = new PassengerQueue();
            Random         random         = new Random();

            for (int i = 0; i < random.Next(10, 20); i++)
            {
                passengerQueue.AddToQueue(random.Next(2) == 1 ? new Passenger(CreateRandomString(),
                                                                              CreateRandomString(), random.Next(1, 100)) : new PassengerWithChildren(CreateRandomString(), CreateRandomString(),
                                                                                                                                                     random.Next(1, 100), random.Next(1, 20)));
            }
            passengerQueue.StartServingQueue();
            Console.ReadKey();
        }