Exemplo n.º 1
0
        static void Main()
        {
            Console.Write("Welcome to pet-shop!\nEnter the age of the cat: ");
            var cat = new Cat(Console.ReadLine());
            Console.WriteLine("\nCongratulation! Your cat is created!");

            while (true)
            {
                Console.WriteLine("\nInformation about the cat:");
                Console.WriteLine("Name: {0}\nAge: {1}\nColor: {2}\n", cat.Name, cat.Age, cat.CurrentColor);

                Console.WriteLine("Choose what you wanna do with your cat.");
                Console.WriteLine("1. Set name\n2. Set color\n3. Punish\n4. Feed");
                switch (Console.ReadLine())
                {
                    case "1":
                        Console.Write("Enter the name: ");
                        cat.Name = Console.ReadLine();
                        break;
                    case "2":
                        Console.Write("Enter the sick color: ");
                        cat.Color.SickColor = Console.ReadLine();
                        Console.Write("Enter the healthy color: ");
                        cat.Color.HealthyColor = Console.ReadLine();
                        break;
                    case "3":
                        cat.Punish();
                        break;
                    case "4":
                        cat.Feed();
                        break;
                }

            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Какого возраста кошку Вы желаете?");
            int age1;
            age1 = int.Parse(Console.ReadLine());
            //    Console.WriteLine(age1);
            var cat1 = new Cat(age1);
               // Console.WriteLine(cat1.Age);
            int k = 1;
            while (k == 1)
            {
                Console.WriteLine(" - Имя кошки " + cat1.Name + "\n - Возраст " + cat1.Age + " \n - Цвет "+cat1.CurrentColor);
                Console.WriteLine("Выберите дальнейшие действия:");
                Console.WriteLine("Нажмите 1 для выбора клички (имейте в виду, это можно сделать только один раз)\nНажмите 2 для выбора цвета кошки\nНажмите 3 для наказания кошки\nНажмите 4 чтобы ее покормить");
                int a1;
                a1 = int.Parse(Console.ReadLine());
            //    Console.WriteLine(a1);
                if (a1 == 1)
                {
                    Console.WriteLine("Вводите кличку");
                    cat1.Name = Console.ReadLine();
                }
                if (a1 == 2)
                {
                    Console.WriteLine("Для введения цвета здоровой довольной кошки нажмите 1. Больной 2.");
                    a1 = int.Parse(Console.ReadLine());
                    if (a1 == 1)
                    {
                        cat1.Color.HealthyColor = Console.ReadLine();
                    }
                    else if (a1 == 2)
                        {
                            cat1.Color.SickColor = Console.ReadLine();
                        }
                }
                if (a1 == 3)
                {
                   cat1.Punish();
                }
                if (a1 == 4)
                {
                    cat1.Feed();
                }
                // Console.WriteLine(Cat1.CurrentColor);
                //  Console.WriteLine(Cat1.Name);

            }
            Console.ReadKey();
        }
Exemplo n.º 3
0
 static void Main(string[] args)
 {
     int k;
     Console.Write("Животное какого возраста вы бы хотели приобрести?\n");
     var kisa = new Cat (Convert.ToInt32(Console.ReadLine()));
     do
     {
         Console.WriteLine("1) Задать имя;\n2) Задать цвет;\n3) Ударить;\n4) Покормить;\n0) Выход;\n");
         k = Convert.ToInt32(Console.ReadLine());
         switch (k)
         {
             case 1:
             {
                 Console.WriteLine("Введите имя кошки(та):");
                 kisa.Name = Console.ReadLine();
                 break;
             }
             case 2:
             {
                 Console.WriteLine("Вы хотите поменять цвет больной(1) или здоровой(2) кошки(та)?");
                 k = Convert.ToInt32(Console.ReadLine());
                 Console.WriteLine("Введите цвет кошки(та):");
                 if (k == 1) kisa.Color.SickColor = Console.ReadLine();
                 else if (k == 2) kisa.Color.HealthyColor = Console.ReadLine();
                 break;
             }
             case 3:
             {
                 kisa.Punish();
                 break;
             }
             case 4:
             {
                 kisa.Feed();
                 break;
             }
         }
         Console.Clear();
         Console.WriteLine("Текущая информация о кошке(те):");
         Console.WriteLine(kisa.Name);
         Console.WriteLine(kisa.Age);
         Console.WriteLine(kisa.CurrentColor);
     } while (k != 0);
 }
 private static CatViewModel CreateCatViewModelFor(Cat cat)
 {
     var catViewModel = new CatViewModel();
     cat.RenderView(catViewModel);
     return catViewModel;
 }