Exemple #1
0
        public static void Main(string[] args)
        {
            DecreasingCounter counter = new DecreasingCounter(5);

            counter.PrintValue();

            counter.Decrement();
            counter.PrintValue();

            counter.Decrement();
            counter.PrintValue();

            counter.Decrement();
            counter.PrintValue();

            counter.Decrement();
            counter.PrintValue();

            counter.Decrement();
            counter.PrintValue();

            counter.Decrement();
            counter.PrintValue();

            DecreasingCounter counter2 = new DecreasingCounter(10);

            counter2.PrintValue();
            counter2.Reset();
            counter2.PrintValue();
        }
Exemple #2
0
        public static void Main(string[] args)
        {
            DecreasingCounter counter = new DecreasingCounter(20);

            counter.PrintValue();

            counter.Reset();
            counter.PrintValue();
        }
Exemple #3
0
        public static void Main(string[] args)
        {
            DecreasingCounter counter = new DecreasingCounter(20);

            counter.PrintValue();
            counter.Decrement();
            counter.PrintValue();

            counter.Reset();
            counter.PrintValue();
            Console.ReadLine();
        }
        public static void Main(string[] args)
        {
            DecreasingCounter counter = new DecreasingCounter(20); // Creates a new object that has a value.

            counter.PrintValue();                                  // Prints the value.
            counter.Decrement();                                   // Decreases the value by 1.

            counter.PrintValue();
            counter.Decrement();
            counter.Decrement();
            counter.PrintValue();
            counter.Reset(); // Resets the value to 0.

            counter.PrintValue();
            counter.Decrement();
        }
Exemple #5
0
        public static void Main(string[] args)
        {
            DecreasingCounter counter = new DecreasingCounter(11);

            counter.PrintValue();

            counter.Decrement();
            counter.PrintValue();

            counter.Decrement();
            counter.PrintValue();

            Console.WriteLine("After reset");
            counter.Reset();
            counter.PrintValue();

            Console.ReadKey();
        }