Beispiel #1
0
        private static void AddStudent(ref StudentList studentList)
        {
            Student newStudent = new Student("New");

            Console.Write("\nEnter Student Name : ");
            newStudent.Name = Console.ReadLine();
            do
            {
                Console.Write("\nEnter English Marks (Out Of 100) : ");
                while (!Int32.TryParse(Console.ReadLine(), out newStudent.Marks[0, 0]))
                {
                }
            } while (newStudent.EnglishMarks < 0 || newStudent.EnglishMarks > 100);
            do
            {
                Console.Write("\nEnter Math Marks (Out Of 100) : ");
                while (!Int32.TryParse(Console.ReadLine(), out newStudent.Marks[1, 0]))
                {
                }
            } while (newStudent.MathMarks < 0 || newStudent.MathMarks > 100);
            do
            {
                Console.Write("\nEnter Computer Marks (Out Of 100) : ");
                while (!Int32.TryParse(Console.ReadLine(), out newStudent.Marks[2, 0]))
                {
                }
            } while (newStudent.ComputerMarks < 0 || newStudent.ComputerMarks > 100);

            Console.WriteLine("****************************\n");
            studentList.AddStudent(newStudent);
        }
Beispiel #2
0
        public void TestAddStudent()
        {
            var student     = new Student("Tom Erik", "*****@*****.**");
            var studentList = new StudentList();
            var result      = studentList.AddStudent(student);

            Assert.AreEqual(true, result);
        }
Beispiel #3
0
        public void StudentList_AddStudent()
        {
            Student testStudent = new Student();

            StudentList.AddStudent(testStudent);

            Assert.IsTrue(StudentList.students.Contains(testStudent));
        }
Beispiel #4
0
        public void StudentList_RemoveStudent()
        {
            Student testStudent = new Student();

            StudentList.AddStudent(testStudent);
            StudentList.RemoveStudent(testStudent);

            Assert.IsFalse(StudentList.students.Contains(testStudent));
        }
Beispiel #5
0
        public void TestRemoveStudentFail()
        {
            var student     = new Student("Tom Erik", "*****@*****.**");
            var student2    = new Student("Torfin", "*****@*****.**");
            var studentList = new StudentList();

            studentList.AddStudent(student);
            var result = studentList.RemoveStudent(student2);

            Assert.AreEqual(false, result);
        }
Beispiel #6
0
        public void TestAddCourseToStudent()
        {
            var student1    = new Student("Tom Erik", "*****@*****.**");
            var course1     = new Course("StartIT");
            var courseList  = new CourseList();
            var studentList = new StudentList();
            var addStudent  = studentList.AddStudent(student1);

            courseList.AddCourse(course1);

            var result = studentList.AddCourseToStudent(course1, student1);

            Assert.AreEqual(true, result);
        }
Beispiel #7
0
        private void DefaultStudents()
        {
            Student matt  = new Student("Matt Brigs", 95, 97, 92);
            Student chris = new Student("Chris Kole", 97, 88, 91);
            Student brian = new Student("Brian Wilks", 94, 79, 86);

            StudentList.AddStudent(matt);
            StudentList.AddStudent(chris);
            StudentList.AddStudent(brian);

            FillListBox();

            lsbxMain.SelectedIndex = 0;
        }
        public ViewResult StudentForm(Student student)
        {
            Course course = CourseList.Courses.Where(c => c.CourseName == student.SelectedCourse).FirstOrDefault();

            course.SList.Add(student);
            if (ModelState.IsValid)
            {
                StudentList.AddStudent(student);
                return(View("ThankYou", student));
            }
            else
            {
                return(View());
            }
        }
Beispiel #9
0
        //----------------------------------------------------------------
        //Button Clicks

        private void btnOkAddStudent_Click(object sender, EventArgs e)
        {
            if (txtNameAddStudent.Text != "")
            {
                Student newStudent = new Student();
                newStudent.Name = txtNameAddStudent.Text;

                foreach (int score in currentScores)
                {
                    newStudent.AddScore(score);
                }
                StudentList.AddStudent(newStudent);
                this.Close();
            }
            else
            {
                MessageBox.Show("Please enter a name.", "Invalid Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtNameAddStudent.Focus();
            }
        }
Beispiel #10
0
        private static void AddStudents(StudentList myList)
        {
            MessageLine("Press Return when done\n");

            while (true)
            {
                Message("Student Name: ");

                string name = Console.ReadLine();

                if (name == "")
                {
                    break;
                }
                else
                {
                    myList.AddStudent(name);
                    continue;
                }
            }
        }