public void ChangeGrade(Course c, int grade) { TakenCourse toChange = courses.Find(tc => tc.Course.Equals(c)); if (toChange != null) { toChange.Grade = grade; } else { throw new ArgumentException("Can't change non existing grade"); } }
public bool AddCourse(Course c, int grade) { TakenCourse newCourse = new TakenCourse(c, this, grade); if (courses.Contains(newCourse) == false) { courses.Add(newCourse); return true; } else { return false; } }
public TakenCourse(Course course, Student student, int grade) { this.course = course; this.student = student; this.grade = grade; }
public TakenCourse(Course course, Student student) : this(course, student, 0) { }
/// <summary> /// Adds a course with default grade to the /// list of courses the student has passed /// </summary> /// <param name="c">The course to add</param> /// <returns>true if the course is added, false otherwise</returns> public bool AddCourse(Course c) { return AddCourse(c, 0); }
public void AddCourse(Course c) { if (coursesTaught.Contains(c) == false) coursesTaught.Add(c); }