示例#1
0
文件: Program.cs 项目: SynergyD/Task6
        public static void Main(string[] args)
        {
            string instruction = "Input path";

            try
            {
                TicketFactory tickets = new TicketFactory();
                switch (GetAlghorithm(args))
                {
                case Alghorithm.Moscow:
                    MoscowTicketAlghorithm moscowAlghorithm = new MoscowTicketAlghorithm(tickets);
                    Console.WriteLine("Moscow Alghorithm:{0}", moscowAlghorithm.CountLuckyTickets());
                    break;

                case Alghorithm.Piter:
                    PiterTicketAlghorithm piterAlghorithm = new PiterTicketAlghorithm(tickets);
                    Console.WriteLine("Piter Alghorithm:{0}", piterAlghorithm.CountLuckyTickets());
                    break;

                case Alghorithm.None:
                    Console.WriteLine("Not complete");
                    break;
                }
            }
            catch (FileNotFoundException e)
            {
                Console.WriteLine(instruction);
            }
            catch (ArgumentOutOfRangeException e)
            {
                Console.WriteLine(instruction);
            }
        }
示例#2
0
 protected LuckyTicketInspectorAlghorithm(TicketFactory tickets)
 {
     _tickets = tickets;
 }