using System.Collections.Generic;
public class StudentRecord : IComparable<StudentRecord>
List<string> course = new List<string>();
List<string> grade = new List<string>();
public StudentRecord(string n, List<string> co, List<string> gr)
public double CalculateGPA()
double a=4.0,b=3.3,c=2.7,f=0.0;
for (int i = 0; i < course.Count; i++)
else if (grade[i] == "B")
else if (grade[i] == "C")
else if (grade[i] == "F")
return gpa = (sum / course.Count);
public int CompareTo(StudentRecord r)
if (gpa < r.gpa) return 1;
else if (gpa == r.gpa) return 0;
public static void Main()
List<StudentRecord> x = new List<StudentRecord>();
List<string> jc = new List<string>();
List<string> jg = new List<string>();
List<string> mc = new List<string>();
List<string> mg = new List<string>();
List<string> joc = new List<string>();
List<string> jog = new List<string>();
List<string> sc = new List<string>();
List<string> sg = new List<string>();
x.Add(new StudentRecord("John",jc,jg));
x.Add(new StudentRecord("Mary",mc,mg));
x.Add(new StudentRecord("Joe",joc,jog));
x.Add(new StudentRecord("Susie",sc,sg));
foreach (StudentRecord y in x){