Esempio n. 1
0
        public void Add()
        {
            int             menu;
            Random          rand = new Random();
            InternalCEngine iEng = new InternalCEngine();
            Diesel          dies = new Diesel();
            Engine          eng  = new Engine();
            TurbojetEngine  turb = new TurbojetEngine();

            menu = rand.Next(4);

            switch (menu)
            {
            case 0:
                stackEng.Push(eng.MakeRandom());
                listEng.Add(eng.MakeRandom());
                break;

            case 1:
                stackEng.Push(dies.MakeRandom());
                listEng.Add(dies.MakeRandom());
                break;

            case 2:
                stackEng.Push(iEng.MakeRandom());
                listEng.Add(iEng.MakeRandom());
                break;

            case 3:
                stackEng.Push(turb.MakeRandom());
                listEng.Add(turb.MakeRandom());
                break;
            }
            Size++;
        }
Esempio n. 2
0
        public Collections(int size)
        {
            Random rand = new Random();
            int    menu;

            Size = size;
            InternalCEngine iEng = new InternalCEngine();
            Diesel          dies = new Diesel();
            Engine          eng  = new Engine();
            TurbojetEngine  turb = new TurbojetEngine();

            for (int i = 0; i < size; i++)
            {
                menu = rand.Next(4);

                switch (menu)
                {
                case 0:
                    stackEng.Push(eng.MakeRandom());
                    listEng.Add(eng.MakeRandom());
                    break;

                case 1:
                    stackEng.Push(dies.MakeRandom());
                    listEng.Add(dies.MakeRandom());
                    break;

                case 2:
                    stackEng.Push(iEng.MakeRandom());
                    listEng.Add(iEng.MakeRandom());
                    break;

                case 3:
                    stackEng.Push(turb.MakeRandom());
                    listEng.Add(turb.MakeRandom());
                    break;
                }
            }
        }