Esempio n. 1
0
        public void Run()
        {
            while (true)
            {
                string input = Console.ReadLine();
                if (input == "Beast!")
                {
                    break;
                }

                try
                {
                    string[] data = Console.ReadLine().Split();

                    string name   = data[0];
                    int    age    = int.Parse(data[1]);
                    string gender = data[2];

                    Animal animal = animalFactory.CreatAnimal(input, name, age, gender);
                    animals.Add(animal);
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            Print();
        }