Ejemplo n.º 1
0
 public static void Count(ICountable c, int MaxCount)
 {
     Console.WriteLine("");
     for (; c.GetCount() <= MaxCount; c.IncrementCount())
     {
         Console.WriteLine(c.ToString());
     }
     c.ResetCount();
 }
Ejemplo n.º 2
0
        public static void Count(ICountable c, int maxCount)
        {
            for (int i = 1; i <= maxCount; i++)
            {
                c.IncrementCount();
                Console.WriteLine(c.GetCountString() + " " + c.Name + "\n");
            }

            c.ResetCount();
        }
Ejemplo n.º 3
0
 public void Count(ICountable c, int MaxCount)
 {
     Console.WriteLine($"Counting {c.GetType().Name}s:\n");
     for (int i = 0; i < MaxCount; i++)
     {
         c.IncrementCount();
         Console.WriteLine($"{c.GetCount()}. {c.ReturnName()}");
     }
     c.ResetCount();
     Console.WriteLine("");
 }
Ejemplo n.º 4
0
 public static void Count(ICountable c, int maxCount)
 {
     //use while to count the number of Countable objects
     while (maxCount != 0)
     {
         c.IncrementCount();
         Console.WriteLine(c.GetCountString());
         maxCount--;
     }
     Console.WriteLine();
     //reset the count
     c.ResetCount();
 }