Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //Create a new droid collection and set the size of it to 100.
            IDroidCollection droidCollection = new DroidCollection(100);

            //Add 10 hard coded droids to the collections
            droidCollection.Add("Carbonite", "Protocol", "Silver", 10);                              //Protocol $350
            droidCollection.Add("Vanadium", "Astromech", "Gold", true, true, true, false, 2);        //Astromech $315
            droidCollection.Add("Carbonite", "Janitorial", "Bronze", false, true, true, true, true); //Janitorial $240
            droidCollection.Add("Quadranium", "Utility", "Silver", true, true, true);                //Utility $255
            droidCollection.Add("Carbonite", "Astromech", "Bronze", false, false, false, false, 1);  //Astromech $145
            droidCollection.Add("Vanadium", "Utility", "Silver", true, false, true);                 //Utility $190
            droidCollection.Add("Carbonite", "Protocol", "Bronze", 1);                               //Protocol $125
            droidCollection.Add("Quadranium", "Astromech", "Gold", true, true, true, true, 10);      //Astromech $740
            droidCollection.Add("Vanadium", "Utility", "Gold", false, false, true);                  //Utility $155
            droidCollection.Add("Vanadium", "Janitorial", "Bronze", true, true, true, true, true);   //Janitorial $295

            //Create a user interface and pass the droidCollection into it as a dependency
            UserInterface userInterface = new UserInterface(droidCollection);

            //Display the main greeting for the program
            userInterface.DisplayGreeting();

            //Display the main menu for the program
            userInterface.DisplayMainMenu();

            //Get the choice that the user makes
            int choice = userInterface.GetMenuChoice();

            //While the choice is not equal to 3, continue to do work with the program
            while (choice != 5)
            {
                //Test which choice was made
                switch (choice)
                {
                    //Choose to create a droid
                    case 1:
                        userInterface.CreateDroid();
                        break;

                    //Choose to Print the droid
                    case 2:
                        userInterface.PrintDroidList();
                        break;
                    //Sort droids by model
                    case 3:
                        break;
                    //sort droids by cost
                    case 4:
                        break;

                }
                //Re-display the menu, and re-prompt for the choice
                userInterface.DisplayMainMenu();
                choice = userInterface.GetMenuChoice();
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //Create a new droid collection and set the size of it to 100.
            IDroidCollection droidCollection = new DroidCollection(100);
            //Add 12 random droids
            droidCollection.Add(12);

            //Create a user interface and pass the droidCollection into it as a dependency
            UserInterface userInterface = new UserInterface(droidCollection);

            //Display the main greeting for the program
            userInterface.DisplayGreeting();

            //Display the main menu for the program
            userInterface.DisplayMainMenu();

            //Get the choice that the user makes
            int choice = userInterface.GetMenuChoice();

            //While the choice is not equal to 3, continue to do work with the program
            while (choice != 5)
            {
                //Test which choice was made
                switch (choice)
                {
                    //Choose to create a droid
                    case 1:
                        userInterface.CreateDroid();
                        break;

                    //Choose to Print the droid
                    case 2:
                        userInterface.PrintDroidList();
                        break;

                    //Choose to organize droids by type
                    case 3:
                        userInterface.Organize();
                        break;

                    //Choose to sort droids by total cost
                    case 4:
                        userInterface.Sort();
                        break;

                    case 5:
                        break;
                }
                //Re-display the menu, and re-prompt for the choice
                userInterface.DisplayMainMenu();
                choice = userInterface.GetMenuChoice();
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            int windowheight = 60;
            int windowwidth = 160;
            UserInterface MainMenu = new UserInterface();

            Console.BufferHeight = 8000;
            Console.BufferWidth = 100;
            Console.SetWindowSize(windowwidth, windowheight);

            MainMenu.MainMenu();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            //bool dontexit = true;

            //PRINT WELCOME HEADER
            Console.WriteLine("    Jawa Droid Manager" + Environment.NewLine);
            Console.WriteLine("         ,-----.{0}       ,'_/_|_\\_`.{0}      /<<::8[O]::>\\{0}     _|-----------|_{0} :::|  | ====-=- |  |:::{0} :::|  | -=-==== |  |:::{0} :::\\  | ::::|()||  /:::{0} ::::| | ....|()|| |::::{0}     | |_________| |{0}     | |\\_______/| |{0}    /   \\ /   \\ /   \\{0}    `---' `---' `---'{0}", Environment.NewLine);

            //Create a new droid collection and set the size of it to 100.
            IDroidCollection droidCollection = new DroidCollection(100);

            //Create a user interface and pass the droidCollection into it as a dependency
            UserInterface userInterface = new UserInterface(droidCollection);

            //Display the main menu for the program
            userInterface.DisplayMainMenu();

            //Get the choice that the user makes
            int choice = userInterface.GetMenuChoice();

            while (choice != 5)
            {
                //Test which choice was made
                switch (choice)
                {
                    case 1:
                        userInterface.CreateDroid();
                        break;
                    case 2:
                        userInterface.ColorCodeDroidList();
                        break;
                    case 3:
                        droidCollection.SortByModel();
                        userInterface.ColorCodeDroidList();
                        break;
                    case 4:
                        droidCollection.SortByCost();
                        userInterface.ColorCodeDroidList();
                        break;
                    default:
                        userInterface.DisplayError();
                        break;
                }

            //Re-display the menu, and re-prompt for the choice
            userInterface.DisplayMainMenu();
            choice = userInterface.GetMenuChoice();
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            //Create a new droid collection and set the size of it to 100.
            IDroidCollection droidCollection = new DroidCollection(100);

            //Create a user interface and pass the droidCollection into it as a dependency
            UserInterface userInterface = new UserInterface(droidCollection);

            //Creates a merge sort class.
            MergeSort mergeSort = new MergeSort();

            //Example droids for use in testing the program.
            //9 droids to make sure it works even with odd numbered arrays/lists.
            droidCollection.Add("Carbonite", "Utility", "Bronze", true, true, true);
            droidCollection.Add("Carbonite", "Protocol", "Bronze", 3);
            droidCollection.Add("Carbonite", "Astromech", "Bronze", true, true, true, true, 5);
            droidCollection.Add("Carbonite", "Janitor", "Bronze", true, true, true, true, true);

            droidCollection.Add("Carbonite", "Utility", "Silver", true, true, true);
            droidCollection.Add("Carbonite", "Protocol", "Silver", 3);
            droidCollection.Add("Carbonite", "Astromech", "Silver", true, true, true, true, 5);
            droidCollection.Add("Carbonite", "Janitor", "Silver", true, true, true, true, true);

            droidCollection.Add("Vanadium", "Protocol", "Gold", 6);

            //Display the main greeting for the program
            userInterface.DisplayGreeting();

            //Display the main menu for the program
            userInterface.DisplayMainMenu();

            //Get the choice that the user makes
            int choice = userInterface.GetMenuChoice();

            //While the choice is not equal to 5, continue to do work with the program
            while (choice != 5)
            {
                //Test which choice was made
                switch (choice)
                {
                    //Choose to create a droid
                    case 1:
                        userInterface.CreateDroid();
                        break;

                    //Choose to Print the droid
                    case 2:
                        userInterface.PrintDroidList();
                        break;
                    //Choose to sort the list by droid type
                    case 3:
                        droidCollection.SortByDroid();
                        break;
                    //Chose to sort the list by droid total price
                    case 4:
                        droidCollection.SortByPrice();
                        break;
                }
                //Re-display the menu, and re-prompt for the choice
                userInterface.DisplayMainMenu();
                choice = userInterface.GetMenuChoice();
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            //Create a new droid collection and set the size of it to 100.
            IDroidCollection droidCollection = new DroidCollection(100);

            //Create a few droids to put into the list so that they do not NEED to be made through the UI
            droidCollection.Add("Carbonite", "Protocol", "Bronze", 12);
            droidCollection.Add("Vanadium", "Utility", "Gold", true, true, true);
            droidCollection.Add("Vanadium", "Janitor", "Silver", true, true, true, true, true);
            droidCollection.Add("Carbonite", "Astromech", "Bronze", true, true, false, true, 80);
            droidCollection.Add("Quadranium", "Protocol", "Silver", 22);
            droidCollection.Add("Carbonite", "Janitor", "Bronze", false, false, false, false, true);
            droidCollection.Add("Vanadium", "Utility", "Gold", true, true, false);
            droidCollection.Add("Quadranium", "Astromech", "Silver", false, true, false, true, 150);
            droidCollection.Add("Quadranium", "Janitor", "Gold", false, true, true, true, true);
            droidCollection.Add("Vanadium", "Utility", "Gold", true, false, true);
            droidCollection.Add("Carbonite", "Astromech", "Bronze", true, false, false, true, 100);
            droidCollection.Add("Carbonite", "Janitor", "Silver", false, true, false, true, true);

            //Create a user interface and pass the droidCollection into it as a dependency
            UserInterface userInterface = new UserInterface(droidCollection);

            //Display the main greeting for the program
            userInterface.DisplayGreeting();

            //Display the main menu for the program
            userInterface.DisplayMainMenu();

            //Get the choice that the user makes
            int choice = userInterface.GetMenuChoice();

            //While the choice is not equal to 3, continue to do work with the program
            while (choice != 5)
            {
                //Test which choice was made
                switch (choice)
                {
                    //Choose to create a droid
                    case 1:
                        userInterface.CreateDroid();
                        break;

                    //Choose to Print the droid
                    case 2:
                        userInterface.PrintDroidList();
                        break;

                    case 3:
                        //Print in categorical order
                        droidCollection.SortIntoCategories();
                        userInterface.DisplaySortCategoriesSuccessMessage();
                        break;

                    case 4:
                        //Print in Total Cost order
                        droidCollection.SortByTotalCost();
                        userInterface.DisplaySortTotalCostSuccessMessage();
                        break;
                }
                //Re-display the menu, and re-prompt for the choice
                userInterface.DisplayMainMenu();
                choice = userInterface.GetMenuChoice();
            }
        }