예제 #1
0
        public void addGrade(string studentID, string courseCode, double grade)
        {
            GradeItem gradeItem = new GradeItem();
            gradeItem.CourseCode = courseCode;
            gradeItem.Grade = grade;

            Student student = GetStudentByStudentID(studentID);
            student.ReportCard.AllGrades.Add(gradeItem);
        }
예제 #2
0
        public void GradeBookRepo__CalculateOverallGPA__SetGPA()
        {
            ReportCard reportCard = new ReportCard();
            GradeItem gr = new GradeItem();

            gr.CourseCode = "HIS 100";
            gr.Grade = 4.0;
            reportCard.AllGrades.Add(gr);

            gr.CourseCode = "CSC 204";
            gr.Grade = 4.0;
            reportCard.AllGrades.Add(gr);

            GradeBookRepo repo = new GradeBookRepo();
            repo.CalculateOverallGPA(reportCard);

            Assert.IsTrue(reportCard.OverallGPA == 4.0, "Perfect grade");
        }
예제 #3
0
        private void insertStudentData()
        {
            Student stu = new Student();
            stu.FirstName = "Jim";
            stu.LastName = "Bob";
            stu.CollegeID = "4444";

            ReportCard reportCard = new ReportCard();
            GradeItem gr = new GradeItem();

            gr.CourseCode = "HIS 100";
            gr.Grade = 4.0;
            reportCard.AllGrades.Add(gr);

            gr.CourseCode = "CSC 204";
            gr.Grade = 4.0;
            reportCard.AllGrades.Add(gr);

            StudentRecord.Rows.Add(stu, reportCard);
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            GradeItem item = new GradeItem();
            item.Course = (Course)comboBox3.SelectedItem;
            try
            {
                item.Grade = double.Parse(textBoxGradeForCourse.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Grade value must be a number.");
            }
            string name = comboBox2.SelectedValue.ToString();

            foreach (Student student in AllStudents)
            {
                if (student.FullName == name)
                {
                    //student.ReportCard.AllGrades = new List<GradeItem>();
                    student.ReportCard.AllGrades.Add(item);
                }
            }

            textBoxGradeForCourse.Text = "";
        }