Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace learn1
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool isOpen = true;
- Enclosure[] enclosures = {new Cats("Это вальер с Кошками",10,),}
- int userInput;
- while (isOpen)
- {
- Console.WriteLine("К какому вальеру подойти хотите?");
- Console.WriteLine("1 - первый.\n2 - второй.\n3 - третий\n4 - четвертый");
- userInput = Convert.ToInt32(Console.ReadLine());
- }
- }
- }
- abstract class Enclosure
- {
- private string _information;
- private int _animals;
- private string _floor;
- public Enclosure(string information, int animals, string floor) {
- _information = information; ;
- _animals = animals;
- _floor = floor;
- }
- abstract public void MakeSound(string floor);
- }
- class Cats : Enclosure
- {
- public Cats(string information, int animals, string floor) : base(information, animals, floor)
- {
- }
- public override void MakeSound(string floor)
- {
- if(floor == "он")
- {
- Console.WriteLine("Мммяу - Мммяу - Мммяу");
- }
- else
- {
- Console.WriteLine("Мяу - Мяу - Мяу");
- }
- }
- }
- class Dogs : Enclosure
- {
- public Dogs(string information, int animals, string sound, string floor) : base(information, animals,floor)
- {
- }
- public override void MakeSound(string floor, string sound)
- {
- if (floor == "он")
- {
- Console.WriteLine("РРррррр - Гав - Гав - Ррррррр");
- }
- else
- {
- Console.WriteLine("Гав - Гав - Гав");
- }
- }
- }
- class Ducks : Enclosure
- {
- public Ducks(string information, int animals, string sound, string floor) : base(information, animals, sound, floor)
- {
- }
- public override void MakeSound(string floor, string sound)
- {
- if (floor == "он")
- {
- Console.WriteLine("Ккккрррряяяя - Ккккрррряяяя - Ккккрррряяяя");
- }
- else
- {
- Console.WriteLine("Кря - Кря - Кря");
- }
- }
- }
- class Wolwes : Enclosure
- {
- public Wolwes(string information, int animals, string sound, string floor) : base(information, animals, sound, floor)
- {
- }
- public override void MakeSound(string floor, string sound)
- {
- Console.WriteLine("Аууууууу - Ауууууууу - Ауууууууу");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement