public Student(StudentViewModel studentVM) { this.Id = studentVM.Id; this.LastName = studentVM.LastName; this.FirstName = studentVM.FirstName; this.ClassPeriod = studentVM.ClassPeriod; }
private double calculateStudentTotalGradePercentage(StudentViewModel student) { int totalCoursePoints = 0; int totalStudentPoints = 0; foreach (GradingPeriodViewModel gradingPeriod in this.gradingPeriods) { CourseViewModel course = findCourse(gradingPeriod); totalCoursePoints += course.getTotalPoints(); totalStudentPoints += course.getStudentPoints(student); } if (totalCoursePoints == 0) { return 1.0; } return Convert.ToDouble(totalStudentPoints) / Convert.ToDouble(totalCoursePoints); }