private double avgQuestionbyGroup(StudentGroup sg, int questionid) { double avgquestionByGroup = 0; double numOfParentsFeedback = 0; foreach (Student s in sg.getStudents()) { foreach (ParentsFeedBack pf in s.getParentFeedback()) { foreach (Grade g in pf.getGrades()) { if (g.getQuestion().getId() == questionid) { avgquestionByGroup += g.getValue(); numOfParentsFeedback++; } } } } if (numOfParentsFeedback != 0) { double res = (avgquestionByGroup / numOfParentsFeedback); return(Math.Round(res, 2)); } else { return(0); } }
public void Fill_combo_box_Students() { List <String> namesStudents = new List <String>(); foreach (Student stud in s.getStudents()) { namesStudents.Add(stud.getFullName()); } comboBoxStudents.DataSource = namesStudents; }