public string GetAverageGrade() { int gradeCount = 0; int marks = 0; foreach (List <Grade> grades in this.Grades.Values) { foreach (Grade grade in grades) { marks += grade.Mark; } gradeCount++; } int averageMarks = marks / gradeCount; return(OOPUtil.MarksToGrade(averageMarks)); }
public void Display() { if (this.Grades.Count > 0) { foreach (Module module in this.Grades.Keys) { if (this.Grades[module].Count > 0) { Console.WriteLine($"Grades for Module {module.ModuleName}, {module.ModuleCode}:"); foreach (Grade grade in this.Grades[module]) { grade.Display(); Console.Write("\n"); } } OOPUtil.WriteThinDivider(); } } }
public void DisplayDetails() { Console.WriteLine($"Name: {this.FirstName} " + (this.MiddleName != "" ? this.MiddleName + " " : "") + this.LastName); Console.WriteLine($"Gender: {this.Gender}"); Console.WriteLine($"Student ID: {this.StudentID}"); OOPUtil.WriteIfExists(this.Email, $"Email: {this.Email}"); OOPUtil.WriteIfExists(this.StudentTelephoneNo, $"Student Tel No.: {this.StudentTelephoneNo}"); OOPUtil.WriteIfExists(this.HomePhoneNo, $"Home Phone No.: {this.HomePhoneNo}"); OOPUtil.WriteIfExists(this.HomeAddress, $"Home Address: {this.HomeAddress}"); OOPUtil.WriteIfExists(this.TermTimeAddress, $"Term Time Address: {this.TermTimeAddress}"); if (this.ParentFirstName != "" && this.ParentLastName != "") { Console.WriteLine("Parent Name: "); } if (this.ParentFirstName != "") { Console.Write(this.ParentFirstName + " "); } else if (this.ParentLastName != "") { Console.Write("<unknown> "); } if (this.ParentLastName != "") { Console.Write(this.ParentLastName); } Console.WriteLine("Grades Profile:"); this.StudentGradeProfile.Display(); Console.WriteLine("Reports: "); foreach (Report report in this.ReportCards) { report.Display(); } }