Exemple #1
0
        //GETS THE LANGUAGE COUNT FROM THE USER
        private void AssignLanguageCount()
        {
            Console.WriteLine("{0}How many languages are loaded? ", Environment.NewLine);

            try
            {
                Console.ForegroundColor = ConsoleColor.Green;
                languageCount           = Convert.ToInt32(Console.ReadLine());
                Console.ForegroundColor = ConsoleColor.White;
            }
            catch
            {
                ThrowInputError();
                AssignLanguageCount();
            }

            //ADD THE FINISHED PROTOCOL DROID TO THE DROID LIST IN THE DROIDCOLLECTOR
            droidCollector.addDroid(modelType, materialType, paintColor, languageCount);
        }
Exemple #2
0
        public void AddDroid()
        {
            Console.WriteLine("Enter model of new droid:" + Environment.NewLine +
                              "Available models: " + printStringArray(availableModels));
            string userModel = Console.ReadLine().Trim().ToUpper();

            while (!availableModels.Contains(userModel))
            {   //Check to make sure the chosen model is available
                Console.WriteLine("Model not available, please choose another.");
                userModel = Console.ReadLine().Trim().ToUpper();
            }

            Console.WriteLine("Enter Material: " + Environment.NewLine +
                              "Available materials: " + printStringArray(availableMaterials));
            string userMaterial = Console.ReadLine().Trim().ToUpper();

            while (!availableMaterials.Contains(userMaterial))
            {   //Make sure chosen material is available
                Console.WriteLine("Material not available, please enter different matieral.");
                userMaterial = Console.ReadLine().Trim().ToUpper();
            }

            Console.WriteLine("Enter Color: " + Environment.NewLine +
                              "Available colors: " + printStringArray(availableColors));
            string userColor = Console.ReadLine().Trim().ToUpper();

            while (!availableColors.Contains(userColor))
            {   //Make sure chosen material is available
                Console.WriteLine("Material not available, please enter different matieral.");
                userColor = Console.ReadLine().Trim().ToUpper();
            }

            if (userModel == availableModels[0])
            {   //Protocol Droid
                Console.WriteLine("Enter number of languages: ");
                int userLanguages = Int32.Parse(Console.ReadLine().Trim());
                collector.addDroid(userModel, userMaterial, userColor, userLanguages);
            }
            else
            {   //Utility, Janitor, or Astromech droid
                Console.WriteLine("Toolbox? Y or N: ");
                bool userToolbox = sortBool(Console.ReadLine().Trim().ToUpper());
                Console.WriteLine("Computer Connection? Y or N: ");
                bool userCompConn = sortBool(Console.ReadLine().Trim().ToUpper());
                Console.WriteLine("Arm? Y or N: ");
                bool userArm = sortBool(Console.ReadLine().Trim().ToUpper());

                if (userModel == availableModels[1])
                {   //Utility Droid
                    collector.addDroid(userModel, userMaterial, userColor, userToolbox, userCompConn, userArm);
                }

                if (userModel == availableModels[2])
                {   //Janitor Droid
                    Console.WriteLine("Trash Compactor? Y or N: ");
                    bool userTrash = sortBool(Console.ReadLine().Trim().ToUpper());
                    Console.WriteLine("Vacuum? Y or N: ");
                    bool userVacuum = sortBool(Console.ReadLine().Trim().ToUpper());
                    collector.addDroid(userModel, userMaterial, userColor, userToolbox, userCompConn, userArm, userTrash, userVacuum);
                }

                if (userModel.ToUpper() == availableModels[3])
                {
                    Console.WriteLine("Fire Extringuisher? Y or N: ");
                    bool userFire = sortBool(Console.ReadLine().Trim().ToUpper());
                    Console.WriteLine("Enter number of ships: ");
                    int userShips = Int32.Parse(Console.ReadLine().Trim());
                    collector.addDroid(userModel, userMaterial, userColor, userToolbox, userCompConn, userArm, userFire, userShips);
                }
            }
        }