using System.Collections.Generic;
using System.Threading.Tasks;
private string _programName;
public string ProgramName
private Degree _degreeName;
public UProgram(string ProgramName, Degree DegreeName)
this.ProgramName = ProgramName;
this.DegreeName = DegreeName;
public override string ToString()
return string.Format("The {0} program contains the {1} of Science degree\n", ProgramName, DegreeName.DegreeName);
private string _degreeName;
private Course _courseName;
public Degree(string DegreeName, Course CourseName)
this.DegreeName = DegreeName;
this.CourseName = CourseName;
public override string ToString()
return string.Format("The {0} of Science degree contains the course {1}\n", DegreeName, CourseName.CourseName);
public Course(string CourseName)
this.CourseName = CourseName;
List<Student> students = new List<Student>();
public Student StudentName
List<Professor> professors = new List<Professor>();
public Professor ProfessorName
return professors.Last();
private string _courseName;
public override string ToString()
return string.Format("The {0} course contains {1} student<s> and {2} professor<s>", CourseName, students.Count, professors.Count);
private DateTime BirthDay
public Student(string FirstName, string LastName, DateTime BirthDay, string Address, string City, string Country)
this.FirstName = FirstName;
this.LastName = LastName;
this.BirthDay = BirthDay;
public override string ToString()
return string.Format("Student: {0} {1} was born: {2}\nStudent's full address: {3}, {4}, {5}\n", FirstName, LastName, BirthDay.ToShortDateString(), Country, City, Address);
private DateTime BirthDay
public Professor(string FirstName, string LastName, DateTime BirthDay)
this.FirstName = FirstName;
this.LastName = LastName;
this.BirthDay = BirthDay;
public override string ToString()
return string.Format("Professor: {0} {1} was born: {2}\n", FirstName, LastName, BirthDay.ToShortDateString());
public static void Main(string[] args)
Student Andriy = new Student("Andriy", "Vantsura", new DateTime(1987, 05, 17), "Khotkevych street", "Lviv", "Ukraine");
Student Vitaliy = new Student("Vitaliy", "Sirenko", new DateTime(1988, 09, 24), "Chervonoi Kalyny avenue", "Lviv", "Ukraine");
Student Sergiy = new Student("Sergiy", "Bonk", new DateTime(1982, 08, 24), "Drugdiller street", "Lviv", "Ukraine");
Course course = new Course("Programming with C#");
course.StudentName = Andriy;
course.StudentName = Vitaliy;
course.StudentName = Sergiy;
Professor Igor = new Professor("Igor", "Volkolupov", new DateTime(1953, 04, 18));
course.ProfessorName = Igor;
Degree degree = new Degree("Barchelor", course);
UProgram prog = new UProgram("Information Technology", degree);
Console.WriteLine(prog.ToString());
Console.WriteLine(degree.ToString());
Console.WriteLine(course.ToString());