Beispiel #1
0
        static void Main(string[] args)
        {
            Course course = new Course();

            #region Student Definitions

            int numOfStudents;
            Console.WriteLine("Enter the number of students to be added to a course");
            try
            {
                numOfStudents = Convert.ToInt32(Console.ReadLine());
            }
            catch (Exception e)
            {
                Console.WriteLine("Please enter a valid value ");
            }
            finally
            {
                numOfStudents = Convert.ToInt32(Console.ReadLine());
            }

            Student[] student = new Student[numOfStudents];
            int       count   = 0;
            for (int i = 0; i < student.Length; i++)
            {
                student[i] = new Student();
                {
                    Console.WriteLine("Enter the name and birthday of the student: {0}", i + 1);
                    student[i].StudentName = Console.ReadLine();
                    student[i].Bday        = Console.ReadLine();
                    course.AddStudent(i, student[i]);
                    count++;
                }
            }


            #endregion
            #region Teacher Definitions
            Teacher teaching = new Teacher();
            teaching.TeacherName = "Jinsey";
            course.AddTeacher(teaching);
            #endregion
            #region Course definition

            course.Coursename = "Programming in C#";
            Console.WriteLine("The name of the course is: {0} with {1} students", course.Coursename, count);


            #endregion
            Degree deg = new Degree();
            deg.DegreeName = "Bachelor of Science";
            deg.AddCourse(course);
            Console.WriteLine("The name of the degree is {0} containing the course {1}", deg.DegreeName, deg.CourseTaken.Coursename);
            UProgram prog = new UProgram();
            prog.NameProgram = "Information Technology";
            prog.AddDegree(deg);
            Console.WriteLine("The name of the program is {0} and the degree obtained is {1}", prog.NameProgram, prog.Degr.DegreeName);
            #region Displaying Stats
            Console.WriteLine("Display/Accessing Student data inside Courses");
            for (int i = 0; i < student.Length; i++)
            {
                Console.WriteLine(course.Students[i].StudentName);
            }
            Console.WriteLine("The name of the teacher is: {0}", course.Teach.TeacherName);
            #endregion

            Console.Write("Press any key to continue . . .");
            Console.ReadKey();
        }