Example #1
0
        //method that calls PricingModel to determine the ticket price
        public void parkFunc()
        {
            while (p <= MAX_P)
            {
                Thread.Sleep(RandomClass.getNext(1000, 2000)); // to generate a new price every 1-5 seconds
                changePrice(PricingModel.getPrice());
            }

            Program.parkThreadRunning = false;
        }
Example #2
0
        //function to create a new order
        private void createOrderFunc(string senderId)
        {
            int cardNo = RandomClass.getNext(5000, 7000);                                         //to generate a random card number
            int amount = RandomClass.getNext(10, 200);                                            //to generate a random number of tickets

            OrderClass order = new OrderClass(senderId, cardNo, amount, PricingModel.getPrice()); // new order object

            Console.WriteLine("{0}'s order with {1} tickets has been created at {2}", senderId, amount, DateTime.Now.ToString("hh:mm:ss"));

            Program.multiCellBuffer.setOneCell(order); // insert the new order into multicellbuffer

            orderCreated();
        }