示例#1
0
        /// <summary>
        /// Конструктор класса <see cref="Gladiolus"/>
        /// </summary>
        public static void DefGladioulus()
        {
            Gladiolus gladiolus = new Gladiolus();

            gladiolus.Size = 12.2;
            Console.WriteLine($"Гладиолус\nНазвание: {gladiolus.Name}\nРазмер: {gladiolus.Size}\n");
        }
示例#2
0
        static void Main(string[] args)
        {
            Printer print = new Printer();
            Plant   p1    = new Rose(25, "red") as Rose;

            print.IAmPrinting(p1);
            Console.WriteLine("\n");
            Plant p2 = new Gladiolus(100, "green");

            print.IAmPrinting(p2);
            Plant p3 = new Cactus(1231, "black");

            Plant[] arr = new Plant[2];
            arr[0] = p1;
            arr[1] = p2

                     foreach (Plant item in arr)
            {
                Console.WriteLine("----------------------------------------------------------------");
                print.IAmPrinting(item);
            }


            Container b = new Container();

            b.byk = new List <Plant>();
            b.Add(p3);
            b.Add(p2);
            b.Add(p1);
            Console.WriteLine("\n");
            Console.WriteLine("\n");
            b.Info();

            b.PriceOfFlowers();

            Console.WriteLine("----------------------------------------------------------------");
            Console.WriteLine("----------------------------------------------------------------");
            Console.WriteLine("----------------------------------------------------------------");
            Console.WriteLine("----------------------------------------------------------------");
            Console.WriteLine("----------------------------------------------------------------");
            Controller cont = new Controller();

            cont.Search(b.byk);
            cont.PriceSorting(b.byk);
            b.Info();
        }
示例#3
0
        static void Yourchoice(int choice)
        {
            switch (choice)
            {
            case 1:
                Showbase();
                break;

            case 2:
                Console.WriteLine("Что вы бы хотели купить(Выберите по индексу):");
                Showbase();
                short choiceToBuy = Convert.ToInt16(Console.ReadLine());
                if (choiceToBuy == 1 || choiceToBuy == 2 || choiceToBuy == 3)
                {
                    switch (choiceToBuy)
                    {
                    case 1:
                        Kaktus.Buy();
                        break;

                    case 2:
                        Roses.Buy();
                        Roses.Pleusure();
                        break;

                    case 3:
                        Gladiolus.Buy();
                        Gladiolus.Pleusure();
                        break;
                    }
                }
                break;

            case 3:
            {
                choiceToBuy = 1;
                while (choiceToBuy != 0)
                {
                    Console.WriteLine("0-выход\n1-Добавить элементы в коллекцию\n2-Показать элементы в коллекции" +
                                      "\n3-Удаление элемента из коллекции\n4-Купить букет" +
                                      "");
                    choiceToBuy = Convert.ToInt16(Console.ReadLine());
                    if (choiceToBuy == 1 || choiceToBuy == 2 || choiceToBuy == 3 || choiceToBuy == 4)
                    {
                        switch (choiceToBuy)
                        {
                        case 1:
                            MyCollection.Add(Kaktus, Roses, Gladiolus);
                            break;

                        case 2:
                            MyCollection.Show();
                            break;

                        case 3:
                            MyCollection.Delete();
                            break;

                        case 4:
                            Console.WriteLine($"{Controller.Buy(MyCollection)} руб.");
                            break;
                        }
                    }
                }
            }
                return;

            default: return;
            }
        }