예제 #1
0
        static void Main(string[] args)
        {
            var marbleBag = new MarbleBag(3, 1, 2);

            Console.WriteLine(marbleBag);

            marbleBag.BlueMarble = 5;

            Console.WriteLine(marbleBag);

            if (marbleBag.getTotalNumberOfMarbles() == 9)
            {
                Console.WriteLine("Total is 9, as expected");
            }
            else
            {
                Console.WriteLine("PANIC!!!");
            }

            marbleBag.removeAllGreenMarbles();
            if (marbleBag.getTotalNumberOfMarbles() == 8)
            {
                Console.WriteLine("Total is 8, as expected");
            }
            else
            {
                Console.WriteLine("Panic even more!!!");
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            var marbleBag = new MarbleBag(3, 1, 2);

            Console.WriteLine(marbleBag);

            marbleBag.BlueMarbles = 5;

            var total = marbleBag.getTotalNumberofMarbles();

            Console.WriteLine($"The total number of marbles is: {total}.");

            marbleBag.removeAllGreenMarbles();
            total = marbleBag.getTotalNumberofMarbles();
            Console.WriteLine($"New Total Without Green Marbles: {total}.");
        }