コード例 #1
0
ファイル: Student.cs プロジェクト: akauffmanGG/Gradebook
 public Student(StudentViewModel studentVM)
 {
     this.Id = studentVM.Id;
     this.LastName = studentVM.LastName;
     this.FirstName = studentVM.FirstName;
     this.ClassPeriod = studentVM.ClassPeriod;
 }
コード例 #2
0
        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);
        }