static void Main(string[] args)
        {
            string name = Console.ReadLine();
            int    age  = int.Parse(Console.ReadLine());

            try
            {
                Chicken chicken = new Chicken(name, age);
                Console.WriteLine(
                    "Chicken {0} (age {1}) can produce {2} eggs per day.",
                    chicken.Name,
                    chicken.Age,
                    chicken.ProductPerDay());
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            string  name    = Console.ReadLine();
            int     age     = int.Parse(Console.ReadLine());
            Chicken chicken = new Chicken(name, age);

            Console.WriteLine($"Chicken {chicken.Name} (age {chicken.Age}) can produce {chicken.ProductPerDay()} eggs per day.");
        }
Exemple #3
0
 static void Main(string[] args)
 {
     try
     {
         string name    = Console.ReadLine();
         int    age     = int.Parse(Console.ReadLine());
         var    chicken = new Chicken(name, age);
         Console.WriteLine($"Chicken {chicken.Name} (age {chicken.Age}) can produce {chicken.ProductPerDay()} eggs per day.");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemple #4
0
 static void Main(string[] args)
 {
     try
     {
         string name = Console.ReadLine();
         int age = int.Parse(Console.ReadLine());
         var chicken = new Chicken(name, age);
         Console.WriteLine($"Chicken {chicken.Name} (age {chicken.Age}) can produce {chicken.ProductPerDay()} eggs per day.");
     }
     catch(Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }