Advertisement
alexey3017

Untitled

Mar 27th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace learn1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             bool isOpen = true;
  14.             Enclosure[] enclosures = {new Cats("Это вальер с Кошками",10,),}
  15.             int userInput;
  16.             while (isOpen)
  17.             {
  18.                 Console.WriteLine("К какому вальеру подойти хотите?");
  19.                 Console.WriteLine("1 - первый.\n2 - второй.\n3 - третий\n4 - четвертый");
  20.                 userInput = Convert.ToInt32(Console.ReadLine());
  21.             }
  22.         }
  23.     }
  24.    
  25.     abstract class Enclosure
  26.     {
  27.         private string _information;
  28.         private int _animals;
  29.         private string _floor;
  30.         public Enclosure(string information, int animals,  string floor) {
  31.             _information = information; ;
  32.             _animals = animals;
  33.             _floor = floor;
  34.         }
  35.  
  36.         abstract public void MakeSound(string floor);
  37.     }
  38.  
  39.     class Cats : Enclosure
  40.     {
  41.         public Cats(string information, int animals,  string floor) : base(information, animals,  floor)
  42.         {
  43.         }
  44.  
  45.         public override void MakeSound(string floor)
  46.         {
  47.             if(floor == "он")
  48.             {
  49.                 Console.WriteLine("Мммяу - Мммяу - Мммяу");
  50.             }
  51.             else
  52.             {
  53.                 Console.WriteLine("Мяу - Мяу - Мяу");
  54.             }
  55.            
  56.         }
  57.     }
  58.  
  59.     class Dogs : Enclosure
  60.     {
  61.         public Dogs(string information, int animals, string sound, string floor) : base(information, animals,floor)
  62.         {
  63.         }
  64.  
  65.         public override void MakeSound(string floor, string sound)
  66.         {
  67.             if (floor == "он")
  68.             {
  69.                 Console.WriteLine("РРррррр - Гав - Гав - Ррррррр");
  70.             }
  71.             else
  72.             {
  73.                 Console.WriteLine("Гав - Гав - Гав");
  74.             }
  75.         }
  76.     }
  77.  
  78.     class Ducks : Enclosure
  79.     {
  80.         public Ducks(string information, int animals, string sound, string floor) : base(information, animals, sound, floor)
  81.         {
  82.         }
  83.  
  84.         public override void MakeSound(string floor, string sound)
  85.         {
  86.             if (floor == "он")
  87.             {
  88.                 Console.WriteLine("Ккккрррряяяя - Ккккрррряяяя - Ккккрррряяяя");
  89.             }
  90.             else
  91.             {
  92.                 Console.WriteLine("Кря - Кря - Кря");
  93.             }
  94.         }
  95.     }
  96.     class Wolwes : Enclosure
  97.     {
  98.         public Wolwes(string information, int animals, string sound, string floor) : base(information, animals, sound, floor)
  99.         {
  100.         }
  101.  
  102.         public override void MakeSound(string floor, string sound)
  103.         {
  104.              Console.WriteLine("Аууууууу - Ауууууууу - Ауууууууу");
  105.         }
  106.     }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement