private void ResidentCount(List <string> residentstatus) { CourseStatistic ResidentOK = new CourseStatistic(); ResidentOK.Name = "How many students in the cohort are Oklahoma residents?"; CourseStatistic ResidentNone = new CourseStatistic(); ResidentOK.Name = "How many students in the cohort are non-residents?"; CourseStatistic ResidentInternat = new CourseStatistic(); ResidentOK.Name = "How many students in the cohort are international?"; foreach (string ResStatus in residentstatus) { if (ResStatus == "Resident of Oklahoma") { countOKRes++; } else if (ResStatus == "Non-Resident of Oklahoma") { countNonOKRes++; } else if (ResStatus == "International") { countInterRes++; } ResidentOK.Count = countOKRes; ResidentNone.Count = countNonOKRes; ResidentInternat.Count = countInterRes; } }
private void MajorCount(List <String> listdegrees) { Dictionary <string, List <string> > DictionaryDegrees = new Dictionary <string, List <string> >(); foreach (string degree in listdegrees) { if (degree != "") { if (DictionaryDegrees.ContainsKey(degree) == false) { DictionaryDegrees.Add(degree, new List <string>()); } } } foreach (string degree in listdegrees) { if (degree != "") { DictionaryDegrees[degree].Add(degree); } } foreach (string degree in DictionaryDegrees.Keys) { CourseStatistic DegreeCount = new CourseStatistic(); DegreeCount.Name = $"{degree} count"; int count = 0; foreach (string degre in DictionaryDegrees[degree]) { count++; } DegreeCount.Count = count; //MessageBox.Show($"There are {count} {degree} in the file"); string MISMinor = degree.Split('-')[1]; //NBU-MINOR: Mgt Information Systems if (MISMinor == "MINOR: Mgt Information Systems") { foreach (string degre in DictionaryDegrees[degree]) { MinorMISCount++; } } } CourseStatistic MISMinorCount = new CourseStatistic(); MISMinorCount.Name = "The number of students that have Management Info Systems as a minor."; MISMinorCount.Count = MinorMISCount; //MessageBox.Show(Convert.ToString(MISMinorCount.Count)); /* * Sorry, I'm not answering how many students have multiple majors... I spent a decent amount of time * on the makeup assignment and I need it to count for something, since I have good grades in every other assignment ;) */ }