Exemplo n.º 1
0
 public Ticket(int[] numbers, LuckyTicketType luckyTicketType)
 {
     _numbers = numbers;
     if (luckyTicketType == LuckyTicketType.Moskow)
     {
         _algorithm = new MoskowTicket();
     }
     else if (luckyTicketType == LuckyTicketType.Piter)
     {
         _algorithm = new PiterTicket();
     }
 }
Exemplo n.º 2
0
        public static void Run(string path)
        {
            TicketsCollection myTicketsList = new TicketsCollection();

            using (StreamReader sr = new StreamReader(path))
            {
                LuckyTicketType luckyTicketType = GetLuckyTicketType(sr.ReadLine().ToUpper());
                string          buffer          = sr.ReadLine();

                while (buffer != null)
                {
                    int[] numbers = Validator.ValidateNumberAndReturnArray(buffer);

                    myTicketsList.Add(new Ticket(numbers, luckyTicketType));

                    buffer = sr.ReadLine();
                }

                _view.ShowResult($"Count lucky tickets: { myTicketsList.CountOfLuckyTickets().ToString()}");
            }
        }
Exemplo n.º 3
0
        public static void Run(string path)
        {
            TicketsCollection myTicketsList = new TicketsCollection();

            using (StreamReader sr = new StreamReader(path))
            {
                LuckyTicketType luckyTicketType = GetLuckyTicketType(sr.ReadLine().ToUpper());
                string          buffer          = sr.ReadLine();

                while (buffer != null)
                {
                    int[] numbers = Validator.ValidateNumberAndReturnArray(buffer);

                    myTicketsList.Add(new Ticket(numbers, luckyTicketType));

                    buffer = sr.ReadLine();
                }

                UserIterface.Display(myTicketsList);
            }
        }