Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Student student1 = new Student();
            Student student2 = new Student();
            Student student3 = new Student();
            Course  course   = new Course("Programming with C#");

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

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

            degree.Courses(course);
            UProgram uProgram = new UProgram("Information Technology");

            uProgram.Degrees(degree);
            List <Degree> degrees = uProgram.Degrees();

            Console.WriteLine("The " + uProgram.Name + " program contains the " + degrees[0].Name + " of Science degree");
            Console.WriteLine();
            List <Course> courses = degrees[0].Courses();

            Console.WriteLine("The " + degrees[0].Name + " of Science degree contains the course " + courses[0].Name);
            List <Student> students = courses[0].Students();

            Console.WriteLine();
            Console.WriteLine("The " + courses[0].Name + " course contains " + students.Count + " students(s)");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Course c = new Course("Programming with C#");
            c.students[0] = new Student("Steven", "Chiang", new DateTime(1992, 6, 23));
            c.students[1] = new Student("Wolf", "Wang", new DateTime(1990, 9, 11));
            c.students[2] = new Student("Mo", "Li", new DateTime(1991, 4, 15));
            c.teachers[0] = new Teacher("Yu Je", "Li", new DateTime(1992, 6, 23));

            Degree d = new Degree("Bachelor");
            d.C = c;

            UProgram up = new UProgram("Information Technology");
            up.D = d;

            Console.WriteLine("The {0} program contains the {1} of Science degree", up.ProgramName, up.D.DegreeName);
            Console.WriteLine("The {0} of Science degree contains the course {1}", d.DegreeName, d.C.CourseName);
            Console.WriteLine("The {0} course contains {1} student(s)", c.CourseName, Student.Count);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var student1 = new Student("Faïza", "Harbi", "*****@*****.**", new DateTime(1982, 3, 6), "797 code Avenue",
                "Residence bar", "Montpellier", "Hérault", "34070", "FRANCE", 'F', 3.9f, 100.02m, 4);
            List<Student> students = new List<Student>();
            students.Add(student1);

            var student2 = new Student("Ivan", "Joule", "*****@*****.**", new DateTime(1982, 9, 24), "2 Main Street",
                    "", "Stropia", "", "0407", "MACEDONIA", 'M', 3.8f, 500.60m, 3);
            students.Add(student2);

            var student3 = new Student("Ana", "Blake", "*****@*****.**", new DateTime(1989, 4, 17), "24 Bazinga Road", "Residence Cooper", "Moscow", "", "101000", "RUSSIA",
                    'F', 3.9f, 300.20m, 3);
            students.Add(student3);

            int c = Student.Counter;

            var teacher1 = new Teacher("Julien", "Mazet", "*****@*****.**", new DateTime(1981, 3, 7), "33 Oxford Street",
                "Building 50", "Cambridge", "MA", "3143",
                "USA", 'M', "Computer Science DEV204", 80);

            var teachers = new List<Teacher>();
            teachers.Add(teacher1);

            var course1 = new Course("Programming with C#", "Computer Science DEV204", 80);
            var courses = new List<Course>();
            courses.Add(course1);

            var degree1 = new Degree("Bachelor Of Science", "Computer Science", 80, courses);
            var degrees = new List<Degree>();
            degrees.Add(degree1);

            var uprogram1 = new UProgram("Information Technology", "Dean Winchester", degrees);

            WriteProgramInfo(uprogram1, courses);
            Console.WriteLine("Press a key to continue.....");
            Console.ReadKey();
        }
Exemplo n.º 4
0
 private static void WriteProgramInfo(UProgram uprogram1, List<Course> courses)
 {
     try
     {
         var deg = uprogram1.UDegreesProposed.First();
         var crse = courses.First().Cname;
         Console.WriteLine("The {0} contains the {1} degree.{2}", uprogram1.Uname, deg.Dname, Environment.NewLine);
         Console.WriteLine("The {0} degree contains the course {1}.{2}", deg.Dname, crse, Environment.NewLine);
         Console.WriteLine("The {0} course contains {1} student(s).{2}", crse, Student.Counter, Environment.NewLine);
     }
     catch (InvalidOperationException ioe)
     {
         Console.WriteLine("Invalid type operation", ioe.Message);
     }
     catch (ArgumentNullException ane)
     {
         Console.WriteLine("No input", ane.Message);
     }
 }