Загрузка данных


Вот распределение по файлам:

---

### 1. Файл `Animal.cs` (Шаг 1)

```csharp
using System;

public class Animal
{
    public string Name { get; set; }
    public int Age { get; set; }

    public Animal(string name, int age)
    {
        Name = name;
        Age = age;
        Console.WriteLine("Конструктор Animal");
    }

    public void Eat()
    {
        Console.WriteLine($"{Name} ест.");
    }

    public void Sleep()
    {
        Console.WriteLine($"{Name} спит.");
    }

    public virtual void Speak()
    {
        Console.WriteLine($"{Name} издаёт какой-то звук.");
    }
}
```

---

### 2. Файл `Dog.cs` (Шаг 2)

```csharp
using System;

public class Dog : Animal
{
    public string Breed { get; set; }

    public Dog(string name, int age, string breed) : base(name, age)
    {
        Breed = breed;
        Console.WriteLine("Конструктор Dog");
    }

    public void Bark()
    {
        Console.WriteLine($"{Name} говорит: Гав-гав!");
    }

    public override void Speak()
    {
        base.Speak();
        Console.WriteLine($"{Name} говорит: Гав!");
    }
}
```

---

### 3. Файл `Shape.cs` (Шаг 4)

```csharp
using System;

public abstract class Shape
{
    public string Name { get; set; }
    public abstract double GetArea();

    public void ShowInfo()
    {
        Console.WriteLine($"{Name}: площадь = {GetArea()}");
    }
}

public class Circle : Shape
{
    public double Radius { get; set; }
    public override double GetArea() => Math.PI * Radius * Radius;
}

public class Rectangle : Shape
{
    public double Width { get; set; }
    public double Height { get; set; }
    public override double GetArea() => Width * Height;
}
```

---

### 4. Файл `Employee.cs` (Самостоятельное задание)

```csharp
using System;

public abstract class Employee
{
    public string Name { get; set; }
    public int Id { get; set; }

    public Employee(string name, int id)
    {
        Name = name;
        Id = id;
    }

    public abstract double CalculateSalary();

    public virtual void ShowInfo()
    {
        Console.WriteLine($"Сотрудник: {Name}, ID: {Id}, Зарплата: {CalculateSalary()}");
    }
}

public class Manager : Employee
{
    public double FixedSalary { get; set; }
    public double Bonus { get; set; }
    public int SubordinatesCount { get; set; }

    public Manager(string name, int id, double fixedSalary, double bonus, int subordinates)
        : base(name, id)
    {
        FixedSalary = fixedSalary;
        Bonus = bonus;
        SubordinatesCount = subordinates;
    }

    public override double CalculateSalary() => FixedSalary + Bonus;

    public override void ShowInfo()
    {
        base.ShowInfo();
        Console.WriteLine($"  (Менеджер, подчинённых: {SubordinatesCount})");
    }
}

public class Developer : Employee
{
    public double HourlyRate { get; set; }
    public int HoursWorked { get; set; }

    public Developer(string name, int id, double hourlyRate, int hours)
        : base(name, id)
    {
        HourlyRate = hourlyRate;
        HoursWorked = hours;
    }

    public override double CalculateSalary() => HourlyRate * HoursWorked;

    public override void ShowInfo()
    {
        base.ShowInfo();
        Console.WriteLine($"  (Разработчик, ставка: {HourlyRate}, часов: {HoursWorked})");
    }
}

public class Intern : Employee
{
    public double Stipend { get; set; }

    public Intern(string name, int id, double stipend) : base(name, id)
    {
        Stipend = stipend;
    }

    public override double CalculateSalary() => Stipend;

    public override void ShowInfo()
    {
        base.ShowInfo();
        Console.WriteLine($"  (Стажёр, стипендия: {Stipend})");
    }
}
```

---

### 5. Файл `Program.cs` (Шаги 3, 5 + самостоятельное задание)

```csharp
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        // Шаг 3
        Dog dog = new Dog("Шарик", 3, "Лабрадор");
        dog.Eat();
        dog.Sleep();
        dog.Bark();
        dog.Speak();

        // Шаг 4
        Shape c = new Circle { Name = "Круг", Radius = 5 };
        Shape r = new Rectangle { Name = "Прямоугольник", Width = 4, Height = 6 };
        c.ShowInfo();
        r.ShowInfo();

        // Шаг 5
        Animal animal = new Dog("Бобик", 2, "Овчарка");
        animal.Speak();

        if (animal is Dog dog2)
        {
            dog2.Bark();
        }

        // Самостоятельное задание
        List<Employee> employees = new List<Employee>
        {
            new Manager("Анна", 1, 80000, 15000, 5),
            new Developer("Игорь", 2, 1500, 160),
            new Intern("Маша", 3, 20000)
        };

        foreach (var emp in employees)
        {
            emp.ShowInfo();

            if (emp is Manager manager)
            {
                Console.WriteLine($"  → У менеджера {manager.SubordinatesCount} подчинённых");
            }
            else if (emp is Developer dev)
            {
                Console.WriteLine($"  → Разработчик отработал {dev.HoursWorked} часов");
            }
            else if (emp is Intern intern)
            {
                Console.WriteLine($"  → Стажёр получает стипендию {intern.Stipend}");
            }

            Console.WriteLine();
        }

        Console.ReadKey();
    }
}
```

---

### Кратко:

| Файл            | Что добавлять                          |
|-----------------|----------------------------------------|
| `Animal.cs`     | Класс `Animal`                         |
| `Dog.cs`        | Класс `Dog`                            |
| `Shape.cs`      | Классы `Shape`, `Circle`, `Rectangle`  |
| `Employee.cs`   | Классы `Employee`, `Manager`, `Developer`, `Intern` |
| `Program.cs`    | Метод `Main` со всеми примерами использования |