Untitled

Class Practice
mail@pastecode.io avatar
unknown
csharp
2 months ago
2.6 kB
1
Indexable
Never
Company[] companies = new Company[]
{
    new Company()
    {
        Name = "APro Academy",
        Description = "IT School",
        Location = { Country = { Name = "Kazakhstan", Code = "KZ" }, City = "AT", District = "AV", Street = "ST1", Building = "Build1", Office = "23" },
        PhoneNumber = "7771234578"
    },
    new Company()
    {
        Name = "B-Pro Academy",
        Description = "IT School",
        Location = { Country = { Name = "Canada", Code = "CN" }, City = "SD", District = "WEQ", Street = "ST2", Building = "Build7", Office = "51" },
        PhoneNumber = "123456789"
    }
};

Person alemkhan = new Person()
{
    Name = "Alemkhan",
    Company = companies[0],
    Location = { Country = { Name = "Kazakhstan", Code = "KZ" }, City = "SD", District = "WEQ", Street = "ST2", Building = "Build7", Office = "51" },
};
Person sam = new Person()
{
    Name = "Sam",
    Company = companies[1],
    Location = { Country = { Name = "Kazakhstan", Code = "KZ" }, City = "SD", District = "WEQ", Street = "ST2", Building = "Build7", Office = "51" },
};

Console.WriteLine(alemkhan.Location.Country.Name);

while (true)
{
    Console.WriteLine("Архив");
    Console.WriteLine("1. Показать всех сотрудников");
    Console.WriteLine("2. Найти сотрудника по имени");

    Console.Write("Выберите команду: ");
    switch (Convert.ToInt32(Console.ReadLine()))
    {
        case 1:
            Console.WriteLine("Тут будет список сотрудников");
            break;
        case 2:
            Console.WriteLine("Тут можно будет найти сотрудника по имени");
            break;
        default:
            break;
    }

    Console.WriteLine();
    Console.WriteLine("Для продолжения нажмите любую кнопку");
    Console.ReadKey();
}

// Страна, Город, Район, Улица, Здание, Квартира
class Person
{
    public string Name;
    public Company Company;
    public Location Location;
}

class Company
{
    public string Name;
    public string Description;
    public Location Location;
    public string PhoneNumber;
}

class Location
{
    public Country Country;
    public string City;
    public string District;
    public string Street;
    public string Building;
    public string Office;
}

class Country
{
    public string Name;
    public string Code;
}
Leave a Comment