예제 #1
0
        public GradesEnum CalcGrade()
        {
            GradesEnum grade     = GradesEnum.Z;
            int        maxPoints = this.Section.CalcTotalPoints();

            if (maxPoints > 0)
            {
                int    totalPoints = this.CalcTotalPoints();
                double pct         = totalPoints * 100 / maxPoints;

                if (pct >= 90.0)
                {
                    grade = GradesEnum.A;
                }
                else if (pct >= 80.0)
                {
                    grade = GradesEnum.B;
                }
                else if (pct >= 70.0)
                {
                    grade = GradesEnum.C;
                }
                else if (pct >= 60.0)
                {
                    grade = GradesEnum.D;
                }
                else
                {
                    grade = GradesEnum.F;
                }
            }
            return(grade);
        }
        public GradesEnum CalcGrade()
        {
            GradesEnum grade       = GradesEnum.F;
            int        totalPoints = this.CalcTotalPoints();
            int        maxPoints   = this.Section.CalcTotalPoints();
            double     percent     = (totalPoints * 100) / maxPoints;

            if (percent >= 90)
            {
                grade = GradesEnum.A;
            }
            else if (percent >= 80)
            {
                grade = GradesEnum.B;
            }
            else if (percent >= 70)
            {
                grade = GradesEnum.C;
            }
            else if (percent >= 60)
            {
                grade = GradesEnum.D;
            }

            return(grade);
        }
예제 #3
0
        public GradesEnum CalcGrade()
        {
            GradesEnum grade       = GradesEnum.Z;
            int        totalPoints = this.CalcTotalPoints();

            if (totalPoints >= 90)
            {
                return(GradesEnum.A);
            }
            else if (totalPoints >= 80)
            {
                return(GradesEnum.B);
            }
            else if (totalPoints >= 70)
            {
                return(GradesEnum.C);
            }
            else if (totalPoints >= 60)
            {
                return(GradesEnum.D);
            }
            else
            {
                return(GradesEnum.F);
            }

            return(grade);
        }
예제 #4
0
 public Enrollment(int id, GradeTypesEnum gradeType, GradesEnum grade, Student student, Section section)
 {
     this.AssignmentGrades = new HashSet <AssignmentGrade>();
     this.Id        = id;
     this.GradeType = gradeType;
     this.Grade     = grade;
     this.Section   = section;
     section.Enrollments.Add(this);
     this.Student = student;
     student.Enrollments.Add(this);
 }
 public Enrollment(GradeTypesEnum gradeType, GradesEnum grade, Student student, Section section)
 {
     this.AssignmentGrades = new List <AssignmentGrade>();
     //this.Id = id;
     this.GradeType = gradeType;
     this.Grade     = grade;
     this.Student   = student;
     this.Student.Enrollments.Add(this);
     this.Section = section;
     this.Section.Enrollments.Add(this);
 }
예제 #6
0
        public void EnrollmentCalcGrade()
        {
            Department comc                = this.school.FindDepartment("COMC");
            Course     comc2750            = new Course(100003, "2750", "UML Modeling and Iterative Process", 2, comc);
            Term       term2020spr         = school.FindTerm(2020, TermsEnum.Spr);
            Section    section2750_2020spr = new Section(100002, 24, comc2750, term2020spr);

            // Add Assignments
            new Assignment(10000001, "1A", "Worksheet, identify student grade info classes",
                           10, DateTime.Parse("1/23/2020"), AssignmentTypesEnum.E, section2750_2020spr);
            new Assignment(10000002, "1B", "UML domain model, library books",
                           10, DateTime.Parse("1/29/2020"), AssignmentTypesEnum.E, section2750_2020spr);
            new Assignment(10000003, "1C", "UML Student Info domain model w/associations",
                           10, DateTime.Parse("1/30/2020"), AssignmentTypesEnum.E, section2750_2020spr);
            new Assignment(10000004, "1D", "Modify 1B (Library system): add attributes & operations",
                           10, DateTime.Parse("2/1/2020"), AssignmentTypesEnum.E, section2750_2020spr);
            new Assignment(10000005, "Q1", "Quiz 1",
                           50, DateTime.Parse("2/2/2020"), AssignmentTypesEnum.Q, section2750_2020spr);

            // Add enrollments
            new Enrollment(10000003, GradeTypesEnum.AF, GradesEnum.Z, school.FindStudent(10000015), section2750_2020spr);

            // Add AssignmentGrades
            new AssignmentGrade(10000003, 8, DateTime.Parse("1/22/2019"),
                                section2750_2020spr.FindEnrollment(10000015), section2750_2020spr.FindAssignment("1A"));
            new AssignmentGrade(10000010, 8, DateTime.Parse("1/25/2019"),
                                section2750_2020spr.FindEnrollment(10000015), section2750_2020spr.FindAssignment("1B"));
            new AssignmentGrade(10000016, 8, DateTime.Parse("1/29/2019"),
                                section2750_2020spr.FindEnrollment(10000015), section2750_2020spr.FindAssignment("1C"));
            new AssignmentGrade(10000018, 10, DateTime.Parse("1/26/2019"),
                                section2750_2020spr.FindEnrollment(10000015), section2750_2020spr.FindAssignment("1D"));
            new AssignmentGrade(10000020, 46, DateTime.Parse("1/26/2019"),
                                section2750_2020spr.FindEnrollment(10000015), section2750_2020spr.FindAssignment("Q1"));

            Enrollment enr = section2750_2020spr.FindEnrollment(10000015);

            GradesEnum grade = enr.CalcGrade();

            Assert.AreEqual(GradesEnum.B, grade);
        }