Beispiel #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();
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            DecreasingCounter counter = new DecreasingCounter(20);

            counter.PrintValue();

            counter.Reset();
            counter.PrintValue();
        }
Beispiel #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();
        }
Beispiel #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();
        }