Пример #1
0
        public override int AddCourse(Course course)
        {
            // If the student already exists
            if (this.courses.Any(c => c.Code == course.Code))
                return -1;

            // If the student exceeds their max number of courses or their max weekly hours
            if (this.courses.Count == MaxNumCourses || (course.WeeklyHours + this.TotalWeeklyHours()) > MaxWeeklyHours)
                return 0;

            // Otherwise add the course to the student
            this.courses.Add(course);
            return 1;
        }
Пример #2
0
 public abstract int AddCourse(Course course);