Example #1
0
        static void Main(string[] args)
        {
            // Instantiating 3 students:
            Student st1 = new Student("john", "nicole");
            Student st2 = new Student("barbara", "fry");
            Student st3 = new Student("Smith", "Jones");

            //Adding 5 gradse for each students:
            st1.Grades.Push(19);
            st1.Grades.Push(20);
            st1.Grades.Push(10);
            st1.Grades.Push(10);
            st1.Grades.Push(15);
            st2.Grades.Push(18);
            st2.Grades.Push(19);
            st2.Grades.Push(17);
            st2.Grades.Push(16);
            st2.Grades.Push(12);
            st3.Grades.Push(20);
            st3.Grades.Push(16);
            st3.Grades.Push(17);
            st3.Grades.Push(15);
            st3.Grades.Push(10);
            // Instantiating a course with the specified name:
            Course cs1 = new Course("Programming with C#");

            //Adding students to the object course using the ArrayList Add method:
            cs1.Students.Add(st1);
            cs1.Students.Add(st2);
            cs1.Students.Add(st3);
            //Instantiating 3 teacher objects:
            Teacher TA1 = new Teacher("Smith");
            Teacher TA2 = new Teacher("katrine");
            Teacher TA3 = new Teacher("Katrine", "Smith");

            //Adding teachers to the object course:
            cs1.Ta[0] = TA1;
            cs1.Ta[1] = TA2;
            cs1.Ta[2] = TA3;
            //Instantiating a Bachelor degree
            Degree dg = new Degree("Bachelor of Science");

            //Adding the instantiated course to the degree
            dg.Cs = cs1;
            //Instantiating a university program called IT:
            UProgram UP = new UProgram("Information Technology");

            //Adding the instantiated degree to the university program:
            UP.Deg = dg;
            //Outputting the requested data using the Console.WriteLine method:
            Console.WriteLine("The program name is {0} and it contains the {1} degree.", UP.Name, dg.Name);
            Console.WriteLine("The {0} degree contains the course {1}.", dg.Name, cs1.Name);
            Console.WriteLine("The number of students enrolled in the {0} course: {1}.", cs1.Name, Student.GetNumOfStudent());
            //Printing the name of the students currently enrolled in the course using the ListStudents method:
            cs1.ListStudents();
            Console.ReadKey();
        }
Example #2
0
        static void Main(string[] args)
        {
            //Create students
            Student student1 = new Student("Jamel", "Winchester", new DateTime(1976, 04, 19));
            Student student2 = new Student("Milford", "Bruch", new DateTime(1984, 12, 05));
            Student student3 = new Student("Damon", "McCurry", new DateTime(1986, 07, 14));

            //Create course
            Course course = new Course("Programming with C#", 4, 12);

            //Add students to ArrayList
            course.studentArray.Add(student1);
            course.studentArray.Add(student2);
            course.studentArray.Add(student3);


            //Not doing random numbers, will add manually.  Teachers don't add random grades..
            //student1 grades
            student1.grades.Push(98);
            student1.grades.Push(85);
            student1.grades.Push(79);
            student1.grades.Push(90);
            student1.grades.Push(78);

            //student2 grades
            student2.grades.Push(79);
            student2.grades.Push(90);
            student2.grades.Push(94);
            student2.grades.Push(95);
            student2.grades.Push(83);

            //student3 grades
            student3.grades.Push(67);
            student3.grades.Push(98);
            student3.grades.Push(93);
            student3.grades.Push(89);
            student3.grades.Push(86);


            //Student count
            int studentCount = Student.StudentCount;

            foreach (var student in course.studentArray)
            {
                studentCount += 1;
            }

            //Old
            Teacher teacher1 = new Teacher("Travis", "Victorino", new DateTime(1968, 11, 22));

            Teacher[] teachers = new Teacher[] { teacher1 };
            Degree    degree   = new Degree("Bachelor of Science", course);
            UProgram  uprogram = new UProgram("Information Technology", degree);

            //Class info
            Console.WriteLine("The {0} program contains the {1} degree.", uprogram.ProgramName, degree.DegreeName);
            Console.WriteLine("The {0} degree contains the course {1}.", degree.DegreeName, course.CourseName);
            Console.WriteLine("The {0} course contains {1} students.", course.CourseName, studentCount);
            Console.WriteLine("----------------------------------------------------------------------");

            //Display students and grades
            Console.WriteLine("Currently enrolled students and their grades:");
            course.ListStudents();
            Console.ReadKey();
        }