Exemplo n.º 1
0
        static void Main(string[] args)
        {
            StudentCatalog students = new StudentCatalog();

            Student anna  = new Student(12, "Anna");
            Student betty = new Student(338, "Betty");
            Student carl  = new Student(92, "Carl");
            Student diana = new Student(295, "Diana");

            anna.AddTestResult("English", 85);
            anna.AddTestResult("Math", 70);
            anna.AddTestResult("Biology", 90);
            anna.AddTestResult("French", 52);

            betty.AddTestResult("English", 77);
            betty.AddTestResult("Math", 82);
            betty.AddTestResult("Chemistry", 65);
            betty.AddTestResult("French", 41);

            carl.AddTestResult("English", 55);
            carl.AddTestResult("Math", 48);
            carl.AddTestResult("Biology", 70);
            carl.AddTestResult("French", 38);

            students.AddStudent(anna);
            students.AddStudent(betty);
            students.AddStudent(carl);
            students.AddStudent(diana);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Run Dictionary Collection demo
        /// </summary>
        public static void Run()
        {
            var students = new StudentCatalog();

            var anna  = new Student(12, "Anna");
            var betty = new Student(338, "Betty");
            var carl  = new Student(92, "Carl");

            anna.AddTestResult("English", 85);
            anna.AddTestResult("Math", 70);
            anna.AddTestResult("Biology", 90);
            anna.AddTestResult("French", 52);

            betty.AddTestResult("English", 77);
            betty.AddTestResult("Math", 82);
            betty.AddTestResult("Chemistry", 65);
            betty.AddTestResult("French", 41);

            students.AddStudent(anna);
            students.AddStudent(betty);
            students.AddStudent(carl);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructs students with their subject s and testcores
        /// </summary>
        static public void excercise4()
        {
            StudentCatalog students = new StudentCatalog();

            Student anna  = new Student(12, "Anna");
            Student betty = new Student(338, "Betty");
            Student carl  = new Student(92, "Carl");
            Student diana = new Student(295, "Diana");

            anna.AddTestResult("English", 85);
            anna.AddTestResult("Math", 70);
            anna.AddTestResult("Biology", 90);
            anna.AddTestResult("French", 52);

            betty.AddTestResult("English", 77);
            betty.AddTestResult("Math", 82);
            betty.AddTestResult("Chemistry", 65);
            betty.AddTestResult("French", 41);

            carl.AddTestResult("English", 55);
            carl.AddTestResult("Math", 48);
            carl.AddTestResult("Biology", 70);
            carl.AddTestResult("French", 38);

            students.AddStudent(anna);
            students.AddStudent(betty);
            students.AddStudent(carl);
            students.AddStudent(diana);

            foreach (var id in students.StudentsList.Keys)
            {
                foreach (var item in students.StudentsList[id].TestScores.Keys)
                {
                    Console.WriteLine(students.StudentsList[id].Name + "  " + item + "   " + students.StudentsList[id].TestScores[item]);
                }
            }
        }
        public void TestAddStudent()
        {
            // Arrange
            TestSetup();

            // Act
            int beforeCount = _students.Count;

            _students.AddStudent(new Student(987, "Eric"));
            int afterCount = _students.Count;

            // Assert
            Assert.AreEqual(4, beforeCount);
            Assert.AreEqual(beforeCount + 1, afterCount);
        }
Exemplo n.º 5
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            Student s = getStudent();

            catalog.AddStudent(s.StudentID, s);
        }