Пример #1
0
        public static void Main()
        {
            var name = Console.ReadLine();
            var age  = int.Parse(Console.ReadLine());

            try
            {
                var chicken = new Chiken(name, age);
                Console.WriteLine($"Chicken {chicken.Name} (age {chicken.Age}) can produce {chicken.ProductPerDay} eggs per day.");
            }
            catch (ArgumentException ae)
            {
                Console.WriteLine(ae.Message);
            }
        }
Пример #2
0
    static void Main(string[] args)
    {
        try
        {
            var name = Console.ReadLine();
            var age  = int.Parse(Console.ReadLine());

            var chiken = new Chiken(name, age);

            Console.WriteLine($"Chicken Mara (age {chiken.Age}) can produce {chiken.GetProductPerDay()} eggs per day.");
        }
        catch (ArgumentException Ex)
        {
            Console.WriteLine(Ex.Message);
        }
    }