Beispiel #1
0
        /// <summary>
        /// Tests the apple class
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // test constructor and properties
            Apple apple = new Apple(true, 1.5f);

            Console.WriteLine("Organic? " + apple.Organic);
            Console.WriteLine("Amount Left: " + apple.AmountLeft);

            for (int i = 0; i < 150; i++)
            {
                apple.TakeBite(0.01f);
                Console.WriteLine("Amount Left: " + apple.AmountLeft);
            }

            Console.ReadLine();
        }
        /// <summary>
        /// Tests the apple class
        /// </summary>
        /// <param name="args">command-line arguments</param>
        static void Main(string[] args)
        {
            // test constructor and properties
            Apple apple = new Apple(true, 1.5f);

            Console.WriteLine("Organic? " + apple.Organic);
            Console.WriteLine("Amount Left: " + apple.AmountLeft);

            // eat the apple
            const float BiteSize = 0.15f;

            while (apple.AmountLeft > 0)
            {
                apple.TakeBite(BiteSize);
                Console.WriteLine("Amount Left: " + apple.AmountLeft);
            }

            Console.WriteLine();
        }