コード例 #1
0
        static void Main(string[] args)
        {
            UProgram prog = new UProgram("Information Technology");

            Student stud1 = new Student("Marko", "Maric");
            Student stud2 = new Student("Luka", "Lukic");
            Student stud3 = new Student("Stjepan", "Stjepic");

            Course course = new Course();

            course.Name     = "Programming with C#";
            course.student1 = stud1;
            course.student2 = stud2;
            course.student3 = stud3;

            Teacher teacher = new Teacher("Ivana", "Ivic");

            course.teacher1 = teacher;

            Degree degree = new Degree();

            degree.Name   = "Bachelor";
            degree.course = course;

            prog.degree = degree;

            Console.WriteLine($"Name of the program is: {prog.Name} and degree is: {prog.degree.Name}");
            Console.WriteLine($"The name of the course in degree is: {prog.degree.course.Name}");
            Console.WriteLine($"Number of students in the course are: {Student.Studentnumber}");
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: skcali/OOP-Course
        static void Main(string[] args)
        {
            // Instantiate new Programing with C# course
            Course Programming = new Course();

            // Add teacher and student objects
            Programming.Students    = new Student[3];
            Programming.Teachers    = new Teacher[1];
            Programming.Students[0] = new Student("Sean");
            Programming.Students[1] = new Student("Kenji");
            Programming.Students[2] = new Student("Cali");
            Programming.Teachers[0] = new Teacher("Mr. Teacher");

            // Instatiate new degree
            Degree Bachelor = new Degree();

            Bachelor.Courses = Programming;

            // Instantiate new IT program
            UProgram ITProgram = new UProgram();

            // Include degree object into new IT program object
            ITProgram.Degrees = Bachelor;

            // Set the amount of students
            var countStudents = Student.CountStudents();

            // Print to console
            Console.WriteLine($"There is a {ITProgram} path that will get you a {ITProgram.Degrees}'s degree");
            Console.WriteLine($"The course name is {ITProgram.Degrees.Courses}");
            Console.WriteLine($"The number of students in the course is {countStudents}");
            Console.ReadLine();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var uprogram = new UProgram("Information Technology");
            var student1 = new Student();
            var student2 = new Student();
            var student3 = new Student();
            var course   = new Course("Programming With C#");

            course.Students.Add(student1);
            course.Students.Add(student2);
            course.Students.Add(student3);
            var teacher = new Teacher();

            course.Teacher = teacher;
            var degree = new Degree("Bachelor");

            degree.Course   = course;
            uprogram.Degree = degree;

            Console.WriteLine("This is the {0} Program, which contains the {1} Degree", uprogram.ProgramName, degree.DegreeName);
            Console.WriteLine("The course in the degree is " + course.CourseName);
            Console.WriteLine("There are {0} Students in the course", Student.CountStudents());
        }