//Add method to add a random droid with a size indicator
        public void Add(int loop)
        {
            Random rand = new Random();
            for (int i = 0; i < loop; i++)
            {
                System.Threading.Thread.Sleep(1);
                switch (rand.Next(4))
                {
                    case 0:
                        droidCollection[lengthOfCollection] = new AstromechDroid();
                        break;

                    case 1:
                        droidCollection[lengthOfCollection] = new JanitorDroid();
                        break;

                    case 2:
                        droidCollection[lengthOfCollection] = new UtilityDroid();
                        break;

                    case 3:
                        droidCollection[lengthOfCollection] = new ProtocolDroid();
                        break;
                }
                lengthOfCollection++;
            }
        }
        //Add method to add a random droid with a size indicator
        public void Add(int loop)
        {
            Random rand = new Random();

            for (int i = 0; i < loop; i++)
            {
                System.Threading.Thread.Sleep(1);
                switch (rand.Next(4))
                {
                case 0:
                    droidCollection[lengthOfCollection] = new AstromechDroid();
                    break;

                case 1:
                    droidCollection[lengthOfCollection] = new JanitorDroid();
                    break;

                case 2:
                    droidCollection[lengthOfCollection] = new UtilityDroid();
                    break;

                case 3:
                    droidCollection[lengthOfCollection] = new ProtocolDroid();
                    break;
                }
                lengthOfCollection++;
            }
        }
        //Constructor that takes in the size of the collection.
        //It sets the size of the internal array that will be used.
        //It also sets the length of the collection to zero since nothing is added yet.
        public DroidCollection(int sizeOfCollection)
        {
            //Make new array for the collection
            droidCollection = new IDroid[sizeOfCollection];

            ProtocolDroid Protocol1 = new ProtocolDroid("Carbonite", "Protocol", "Gold", 10);
            droidCollection[0] = Protocol1;
            ProtocolDroid Protocol2 = new ProtocolDroid("Vanadium", "Protocol", "Silver", 3);
            droidCollection[1] = Protocol2;
            ProtocolDroid Protocol3 = new ProtocolDroid("Quadranium", "Protocol", "Bronze", 14);
            droidCollection[2] = Protocol3;
            UtilityDroid Utility1 = new UtilityDroid("Carbonite", "Utility", "Gold", true, true, true);
            droidCollection[3] = Utility1;
            UtilityDroid Utility2 = new UtilityDroid("Vanadium", "Utility", "Silver", true, true, true);
            droidCollection[4] = Utility2;
            UtilityDroid Utility3 = new UtilityDroid("Quadranium", "Utility", "Bronze", true, true, true);
            droidCollection[5] = Utility3;
            JanitorDroid Janitor1 = new JanitorDroid("Carbonite", "Janitor", "Gold", true, true, true, true, true);
            droidCollection[6] = Janitor1;
            JanitorDroid Janitor2 = new JanitorDroid("Vanadium", "Janitor", "Silver", true, true, true, true, true);
            droidCollection[7] = Janitor2;
            JanitorDroid Janitor3 = new JanitorDroid("Quadranium", "Janitor", "Bronze", true, true, true, true, true);
            droidCollection[8] = Janitor3;
            AstromechDroid Astromech1 = new AstromechDroid("Carbonite", "Astromech", "Gold", true, true, true, true, 5);
            droidCollection[9] = Astromech1;
            AstromechDroid Astromech2 = new AstromechDroid("Vanadium", "Astromech", "Silver", true, true, true, true, 24);
            droidCollection[10] = Astromech2;
            AstromechDroid Astromech3 = new AstromechDroid("Quadranium", "Astromech", "Bronze", true, true, true, true, 11);
            droidCollection[11] = Astromech3;

            //set length of collection to 0
            lengthOfCollection = 12;
        }
 //The Add method for a Janitor droid. Code is the same as the above method except for the type of droid being created.
 public bool Add(string Material, string Model, string Color, bool HasToolBox, bool HasComputerConnection, bool HasArm, bool HasTrashCompactor, bool HasVaccum)
 {
     if (lengthOfCollection < (droidCollection.Length - 1))
     {
         droidCollection[lengthOfCollection] = new JanitorDroid(Material, Model, Color, HasToolBox, HasComputerConnection, HasArm, HasTrashCompactor, HasVaccum);
         lengthOfCollection++;
         return true;
     }
     else
     {
         return false;
     }
 }
Example #5
0
 //The Add method for a Janitor droid. Code is the same as the above method except for the type of droid being created.
 public bool Add(string Material, string Model, string Color, bool HasToolBox, bool HasComputerConnection, bool HasArm, bool HasTrashCompactor, bool HasVaccum)
 {
     if (lengthOfCollection < (droidCollection.Length - 1))
     {
         droidCollection[lengthOfCollection] = new JanitorDroid(Material, Model, Color, HasToolBox, HasComputerConnection, HasArm, HasTrashCompactor, HasVaccum);
         lengthOfCollection++;
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #6
0
        //add Janitor
        public void AddJ()
        {
            Dptions("Janitor");

            Console.WriteLine("==========================================================================");
            Droid newJanitor = new JanitorDroid(materailSelect, "Janitor", colorSelect, toolBox, computerConnection, arm, trashCompactor, vacuum);

            droidCollection.Add(newJanitor);
            newJanitor.CalculateBaseCost();
            newJanitor.CalculateTotalCost();
            totalCost += newJanitor.totalCost;
            Console.WriteLine("COLLECTED: " + newJanitor);
            Console.WriteLine("==========================================================================");
            Console.WriteLine();
        }
Example #7
0
        //adds dummy hardcoded droids
        //decided to shuffle the order of droids for testing
        public void DummyDroids()
        {
            //variables for dummy droid #1
            string material1 = "Steel";
            string color1    = "Blue";
            int    language1 = 2;

            //dummy Protocol #1
            Droid dumbProtocol1 = new ProtocolDroid(material1, "Protocol", color1, language1);

            droidCollection.Add(dumbProtocol1);
            dumbProtocol1.CalculateBaseCost();
            dumbProtocol1.CalculateTotalCost();
            totalCost += dumbProtocol1.totalCost;


            //variables for dummy droid #3
            string material3     = "Fiberglass";
            string color3        = "White";
            bool   dumbTool1     = true;
            bool   dumbComputer1 = false;
            bool   dumbArm1      = true;
            bool   dumbFire1     = true;
            int    dumbShip1     = 150;

            //dummy Astromech #1
            Droid dumbAstromech1 = new AstromechDroid(material3, "Astromech", color3, dumbTool1, dumbComputer1, dumbArm1, dumbFire1, dumbShip1);

            droidCollection.Add(dumbAstromech1);
            dumbAstromech1.CalculateBaseCost();
            dumbAstromech1.CalculateTotalCost();
            totalCost += dumbAstromech1.totalCost;


            //variables for dummy droid #2
            string material2 = "Wood";
            string color2    = "Red";
            int    language2 = 20;

            //dummy Protocol #2
            Droid dumbProtocol2 = new ProtocolDroid(material2, "Protocol", color2, language2);

            droidCollection.Add(dumbProtocol2);
            dumbProtocol2.CalculateBaseCost();
            dumbProtocol2.CalculateTotalCost();
            totalCost += dumbProtocol2.totalCost;

            //variables for dummy droid #5
            string material5     = "Steel";
            string color5        = "Red";
            bool   dumbTool3     = true;
            bool   dumbComputer3 = true;
            bool   dumbArm3      = true;

            //dummy Utility #1
            Droid dumbUtility1 = new UtilityDroid(material5, "Utility", color5, dumbTool3, dumbComputer3, dumbArm3);

            droidCollection.Add(dumbUtility1);
            dumbUtility1.CalculateBaseCost();
            dumbUtility1.CalculateTotalCost();
            totalCost += dumbUtility1.totalCost;


            //variables for dummy droid #4
            string material4     = "Plastic";
            string color4        = "Gold";
            bool   dumbTool2     = false;
            bool   dumbComputer2 = false;
            bool   dumbArm2      = false;
            bool   dumbFire2     = false;
            int    dumbShip2     = 4;

            //dummy Astromech #2
            Droid dumbAstromech2 = new AstromechDroid(material4, "Astromech", color4, dumbTool2, dumbComputer2, dumbArm2, dumbFire2, dumbShip2);

            droidCollection.Add(dumbAstromech2);
            dumbAstromech2.CalculateBaseCost();
            dumbAstromech2.CalculateTotalCost();
            totalCost += dumbAstromech2.totalCost;

            //variables for dummy droid #8
            string material8     = "Steel";
            string color8        = "Red";
            bool   dumbTool6     = true;
            bool   dumbComputer6 = true;
            bool   dumbArm6      = true;
            bool   dumbTrash2    = true;
            bool   dumbVacuum2   = true;

            //dummy Janitor #2
            Droid dumbJanitor2 = new JanitorDroid(material8, "Janitor", color8, dumbTool6, dumbComputer6, dumbArm6, dumbTrash2, dumbVacuum2);

            droidCollection.Add(dumbJanitor2);
            dumbJanitor2.CalculateBaseCost();
            dumbJanitor2.CalculateTotalCost();
            totalCost += dumbJanitor2.totalCost;


            //variables for dummy droid #6
            string material6     = "Steel";
            string color6        = "Black";
            bool   dumbTool4     = true;
            bool   dumbComputer4 = false;
            bool   dumbArm4      = false;

            //dummy Utility #2
            Droid dumbUtility2 = new UtilityDroid(material6, "Utility", color6, dumbTool4, dumbComputer4, dumbArm4);

            droidCollection.Add(dumbUtility2);
            dumbUtility2.CalculateBaseCost();
            dumbUtility2.CalculateTotalCost();
            totalCost += dumbUtility2.totalCost;


            //variables for dummy droid #7
            string material7     = "Wood";
            string color7        = "Blue";
            bool   dumbTool5     = false;
            bool   dumbComputer5 = true;
            bool   dumbArm5      = true;
            bool   dumbTrash1    = true;
            bool   dumbVacuum1   = false;

            //dummy Janitor #1
            Droid dumbJanitor1 = new JanitorDroid(material7, "Janitor", color7, dumbTool5, dumbComputer5, dumbArm5, dumbTrash1, dumbVacuum1);

            droidCollection.Add(dumbJanitor1);
            dumbJanitor1.CalculateBaseCost();
            dumbJanitor1.CalculateTotalCost();
            totalCost += dumbJanitor1.totalCost;
        }