Exemplo n.º 1
0
        public void DeleteInven()
        {
            Console.Clear();

            Inven[] newdelshop = new Inven[] { };

            if (shop.Length == 0)
            {
                Console.WriteLine("нету элементов для удаления");
            }

            else
            {
                Console.Clear();

                Console.WriteLine("функция недоступна");

                //Console.WriteLine("введите 0 если хотите удалить мячи , либо 1 для удаления велосипедов");
                //int deletsomething = int.Parse(Console.ReadLine());

                //if(deletsomething == 0)
                //{
                //    Console.WriteLine("введите 0 если хотите удалить все мячи , либо 1 для удаления конкретного мяча");
                //    int a = int.Parse(Console.ReadLine());
                //    if(a == 0)
                //    {

                //    }
                //    else if(a == 1)
                //    {

                //    }
                //}

                //else if(deletsomething == 1)
                //{
                //    Console.WriteLine("введите 0 если хотите удалить все велосипеды , либо 1 для удаления конкретного велосипеда");
                //    int b = int.Parse(Console.ReadLine());
                //    if (b == 0)
                //    {

                //    }
                //    else if (b == 1)
                //    {

                //    }
                //}

                //int countj = 0;
                //for (int i = 0; i < shop.Length; i++)
                //{
                //        newdelshop[i] = shop[i];
                //        countj += 1;
                //}


                //shop = newdelshop;
            }
        }
Exemplo n.º 2
0
        public void AddInvent()
        {
            Console.Clear();

            Inven[] newshop = new Inven[shop.Length + 1];

            Console.WriteLine("что вы хотите добавить");
            string something = Console.ReadLine();

            if (something == "велосипед")
            {
                Console.WriteLine("name: ");
                string name = Console.ReadLine();
                Console.WriteLine("price: ");
                int price = int.Parse(Console.ReadLine());
                Console.WriteLine("speed: ");
                string speed = Console.ReadLine();

                for (int i = 0; i < shop.Length; i++)
                {
                    newshop[i] = shop[i];
                }

                newshop[newshop.Length - 1] = new BicecleMountain(name, price, speed);
                shop = newshop;
            }

            else if (something == "мяч")
            {
                Console.WriteLine("name: ");
                string name = Console.ReadLine();
                Console.WriteLine("price: ");
                int price = int.Parse(Console.ReadLine());
                Console.WriteLine("type: ");
                string type = Console.ReadLine();

                for (int i = 0; i < shop.Length; i++)
                {
                    newshop[i] = shop[i];
                }

                newshop[newshop.Length - 1] = new Ball(name, price, type);
                shop = newshop;
            }
        }