Bez popisu

vivanov 65a5a1287b second commit před 10 měsíci
.gitignore.txt 429e5ab52f first commit před 11 měsíci
readme.md 65a5a1287b second commit před 10 měsíci

readme.md

Лабораторная работа №13

Сначала использовал enum для перечисления ролей и категорий, затем уже идут сами классы и заролнение данными.


enum rol
{
    Sniper,
    Support,
    Lurker,
    EntryFragger,
    Manager,
    coach
}


enum category
{
    Player,
    Devices,
    Role,
    Staff
}

class Devices {
    public string title { get;set; }
    public string description { get;set; }
    public category Categor;
}

class Staff
{
    public rol role;
    public string firstName { get; set; }
    public string lastName { get; set; }
}
class Player
{
    public rol role;
    public string firstName { get;set; }
    public string lastName { get;set; }
}

class Program
{
    static void Main()
    {
        Devices d = new Devices();
        d.title = "Mouse";
        d.description = "Meet the new weapon of choice for the world’s top esports athletes.";
        d.Categor = category.Devices;
        
        Console.WriteLine($"Category: {d} | Title: {d.title} | Description: {d.description}");
        
        Player p = new Player();
        p.firstName = "Валерий";
        p.lastName = "Иванов";
        p.role = rol.EntryFragger;
        
        Console.WriteLine($"Category: {p} | Name: {p.firstName} | LastName: {p.lastName} | Role: {p.role} ");

        Staff s = new Staff();
        s.firstName = "Артем";
        s.lastName = "Прокопьев";
        s.role = rol.Manager;
        
        Console.WriteLine($"Category: {s} | Name: {s.firstName} | LastName: {s.lastName} | Role: {s.role}");
    }
}

Вывод

Category: Devices | Title: Mouse | Description: Meet the new weapon of choice for the world's top esports athletes.
Category: Player | Name: Валерий | LastName: Иванов | Role: EntryFragger 
Category: Staff | Name: Артем | LastName: Прокопьев | Role: Manager