static void Main(string[] args) { Console.Write("Enter number of courses: "); int coursesCount = int.TryParse(Console.ReadLine(), out coursesCount) ? coursesCount : 0; CreateCoursesList(coursesCount); Console.Write("\nEnter number of students: "); int studentsCount = int.TryParse(Console.ReadLine(), out studentsCount) ? studentsCount : 0; CreateStudentsList(studentsCount); Console.WriteLine( "\nPlease, assign students to courses. Format: <studentID courseId> \nTo finish write \"quit\""); while (true) { string input = Console.ReadLine(); if (input.ToLower().Equals("quit")) { break; } string[] line = input.Split(new char[0]); int studentId = int.TryParse(line[0], out studentId) ? studentId : -1; int courseId = int.TryParse(line[1], out courseId) ? courseId : -1; try { Academy.signupStudentToCourse(studentId, courseId); } catch (StudentNotFoundException se) { Console.WriteLine("Student not found: " + se.Message); } catch (CourseNotFoundException ce) { Console.WriteLine("Course not found: " + ce.Message); } catch (Exception ex) { Console.WriteLine(ex.Message); } } PrintAcademyInfo(); }