Last active
January 20, 2016 11:46
-
-
Save Sander-Kastelein/57740ca270e723994c74 to your computer and use it in GitHub Desktop.
beter voorbeeld
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int getOnvoldoendesByStudent(Student student) | |
{ | |
int onvoldoendeCount = 0; | |
foreach(Exam exam in exams) | |
{ | |
if(exam.Student == student && exam.Score < 5.5m) | |
{ | |
onvoldoendeCount++; | |
} | |
} | |
return onvoldoendeCount; | |
} | |
static string getWorstStudentName() | |
{ | |
Student worstStudent = students.First(); | |
foreach (Student student in students) | |
{ | |
if(getOnvoldoendesByStudent(worstStudent) < getOnvoldoendesByStudent(student)) | |
{ | |
worstStudent = student; | |
} | |
} | |
return worstStudent.Name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment