Example #1
0
        static void Main(string[] args)
        {
            var robot = new Robot();

            SortChip sortChip = new SortChip();

            robot.AcceptChip(sortChip);

            int[] testArray = new int[] { 4, 1, 3, 7, 9, 2, 6 };
            (robot.GetChip() as SortChip).executeSort(testArray, true);

            Console.Write("Total Chips Been Used: ");
            Console.WriteLine(robot.TotalChipBeenUsed);

            SumArrayChip sumChip = new SumArrayChip();

            robot.AcceptChip(sumChip);

            Console.Write("Sum of Array: ");
            Console.WriteLine((robot.GetChip() as SumArrayChip).executeSumArray(testArray));

            Console.Write("Total Chips Been Used: ");
            Console.WriteLine(robot.TotalChipBeenUsed);

            robot.AcceptChip(sortChip);
            Console.Write("Total Chips Been Used: ");
            Console.WriteLine(robot.TotalChipBeenUsed);
        }