Nenhuma descrição

V.Yakimova f1f8302c95 белый носок 9 meses atrás
.idea dd78004f9b baobab 9 meses atrás
gitignore.txt b1eb6d37ef что это 11 meses atrás
readme.md f1f8302c95 белый носок 9 meses atrás

readme.md

Предметная область:

"Университет" 𓆝 𓆟 𓆞 𓆝 𓆟

using System;
using System.Collections.Generic;

public class Entity
{
    public int Id { get; set; }
}

public class Faculty : Entity
{
    public string Name { get; set; }
    public List<Department> Departments { get; set; }
}

public class Department : Entity
{
    public string Name { get; set; }
    public List<Student> Students { get; set; }
}

public class Student : Entity
{
    public string Name { get; set; }
    public int Course { get; set; }
}

class Program
{
    static void Main()
    {
        Faculty faculty = new Faculty
        {
            Id = 1,
            Name = "Информатика и вычислительная техника",
            Departments = new List<Department>()
        };

        Department department = new Department
        {
            Id = 1,
            Name = "Информационные системы и программирование",
            Students = new List<Student>()
        };

        Student student1 = new Student
        {
            Id = 1,
            Name = "Моисей",
            Course = 2
        };

        Student student2 = new Student
        {
            Id = 2,
            Name = "Амир",
            Course = 3
        };

        department.Students.Add(student1);
        department.Students.Add(student2);

        faculty.Departments.Add(department);

        Console.WriteLine($"Faculty: {faculty.Name}");
        foreach (var dept in faculty.Departments)
        {
            Console.WriteLine($"Department: {dept.Name}");
            foreach (var student in dept.Students)
            {
                Console.WriteLine($"Student: {student.Name}, Course: {student.Course}");
            }
        }
    }
}
Faculty: Информатика и вычислительная техника
Department: Информационные системы и программирование
Student: Моисей, Course: 2
Student: Амир, Course: 3