using System.Collections.Generic;
public class StudentRecord : IComparable<StudentRecord>
Dictionary<string, char> course;
public StudentRecord(string name)
course = new Dictionary<string, Char>();
public void AddCourse(string coursename, char Grade)
course.Add(coursename, Grade);
private double CalculateGPA()
foreach(KeyValuePair<string, Char> x in course)
GPA = score / (double) count;
public int CompareTo(StudentRecord other)
double GPAMe = CalculateGPA();
double GPAOther = other.CalculateGPA();
else if(GPAMe < GPAOther)
public static void Main()
List<StudentRecord> studentrecord = new List<StudentRecord>();
StudentRecord John = new StudentRecord("John");
John.AddCourse("IERG3080", 'B');
John.AddCourse("IERG3300", 'A');
StudentRecord Mary = new StudentRecord("Mary");
Mary.AddCourse("IERG3080", 'A');
Mary.AddCourse("IERG3300", 'A');
Mary.AddCourse("GEEC1000", 'B');
StudentRecord Joe = new StudentRecord("Joe");
Joe.AddCourse("IERG3080", 'C');
Joe.AddCourse("IERG3300", 'B');
Joe.AddCourse("ACAT1001", 'C');
StudentRecord Susie = new StudentRecord("Susie");
Susie.AddCourse("CSCI2100", 'C');
Susie.AddCourse("IERG2051", 'F');
studentrecord.Add(Susie);
foreach(StudentRecord student in studentrecord)
Console.WriteLine(student.name);