static void Main(string[] args)
        {
            UProgram schoolProgram1 = new UProgram("Information Technology");
            Degree   bachelors      = new Degree("Bachelors Degree");

            schoolProgram1.degrees[0] = bachelors;
            Course course1 = new Course("Programming with C#");

            bachelors.courses[0] = course1;

            Teacher teacher1 = new Teacher("Dr. Janet", "Doe", "Female", 38);

            course1.teachers[0] = teacher1;
            Student student1 = new Student("Tom", "Sawyer");
            Student student2 = new Student("Jane", "Smithers", "Female", 20);
            Student student3 = new Student("Bob", "Smith", "Male", 22);

            course1.students[0] = student1;
            course1.students[1] = student2;
            course1.students[2] = student3;

            Console.WriteLine("The program of {0} offers a {1}", schoolProgram1.programName, schoolProgram1.degrees[0].degree);
            Console.WriteLine("The {0} program offers a great course called {1}", schoolProgram1.degrees[0].degree, bachelors.courses[0].course);
            Console.WriteLine("There are {0} students in the class and it is taught by {1} {2}", Student.studentCount, course1.teachers[0].firstName, course1.teachers[0].lastName);
            Console.WriteLine(course1.students[2].takeTest());
            Console.WriteLine(course1.students[1].takeTest());
            Console.WriteLine(course1.teachers[0].gradeTest());
        }
        static void Main(string[] args)
        {
            var infoTech = new UProgram("Information Technology");
            var student1 = new Student("Leslie", 2010);
            var student2 = new Student("Amanda", 2011);
            var student3 = new Student("Lisa", 2009);

            var course  = new Course("Programming with C#");
            var course2 = new Course("Programming with F#");

            course.AddStudent(student1);
            course.AddStudent(student2);
            course.AddStudent(student3);

            course2.AddStudent(student1);

            var teacher = new Teacher("Mr Kaplan");

            course.AddTeacher(teacher);

            var degree = new Degree("Bachelor");

            degree.AddCourseToDegree(course);
            degree.AddCourseToDegree(course2);

            infoTech.AddDegree(degree);

            Console.WriteLine($"Program: {infoTech._programName} contains degree: {degree._degree}");

            foreach (Course courseItem in degree._courses)
            {
                Console.WriteLine($"The name of the course in the degree: {courseItem._courseName} with {courseItem._currentStudents.Count} students.");
            }
        }
Beispiel #3
0
        static void Main()
        {
            // Students
            Student[] students =
            {
                new Student("Andrew", "Clark",    17),
                new Student("Claire", "Standish", 16),
                new Student("John",   "Bender", 18)
            };

            // Teacher
            Teacher[] teachers =
            {
                new Teacher("Richard", "Vernon")
            };

            // Course
            Course course = new Course("Programming with C#")
            {
                // Add students to course
                Student = students,

                // Add teacher to course
                Teacher = teachers
            };

            // Degree
            Degree degree = new Degree("Bachelor")
            {
                // Add course to degree
                Course = course
            };

            // UProgram
            UProgram uprogram = new UProgram("Information Technology")
            {
                // Add degree to UProgram
                Degree = degree
            };

            // Write/print course/degree/student information
            Console.WriteLine($"The program is {uprogram.Name} and offers a {degree.Name} degree in the field of {course.Name}. There are currently {Student.numStudents} students enrolled.");
        }