示例#1
0
        static void Main(string[] args)
        {
            //1.Instantiate three Student objects.
            Student objStuDentUno = new Student("Pedro", "Perez", "[email protected] ", DateTime.Parse("20/06/1974"));
            Student objStuDentDos = new Student("Juan", "Segundo", "*****@*****.**", DateTime.Parse("31/01/1985"));
            Student objStuDentTres = new Student("Carlorina", "Tres", "*****@*****.**", DateTime.Parse("17/10/1973"));

            //2.Instantiate a Course object called Programming with C#.
            Course objCourse = new Course(101, "Programming with C#", 5, 1000);

            //3.Add your three students to this Course object.
            objCourse.ArrayStudent[0] = objStuDentUno;
            objCourse.ArrayStudent[1] = objStuDentDos;
            objCourse.ArrayStudent[2] = objStuDentTres;

            //4.Instantiate at least one Teacher object.
            Teacher objteacher = new Teacher();
            objteacher.FirstName = "Roland";
            objteacher.LastName = "Garzon";
            objteacher.Email = "*****@*****.**";
            objteacher.Grade = "10";

            //5.Add that Teacher object to your Course object
            objCourse.ArrayTeacher[0] = objteacher;

            //6.Instantiate a Degree object, such as Bachelor.
            Degree objDegree = new Degree("Bachelor", 6, "Face to Face");

            //7.Add your Course object to the Degree object.
            objDegree.NewCourse = objCourse;

            //8.Instantiate a UProgram object called Information Technology.
            UProgram objUProgram = new UProgram("Information Technology", "Tres", "yes");

            //9.Add the Degree object to the UProgram object.
            objUProgram.NewDegree = objDegree;

            //10.Using Console.WriteLine statements, output the following information to the console window:
            //The name of the program and the degree it contains
            Console.WriteLine("The {0} program contains the {1} of Science degree.", objUProgram.ProgramName, objDegree.Type);
            //The name of the course in the degree
            Console.WriteLine("The {0} of Science degree contains the course {1}.", objDegree.Type, objCourse.NameCourse);
            //The count of the number of students in the course.
            Console.WriteLine("The {0} course contains {1} students.", objCourse.NameCourse, objCourse.Students_number(objCourse.ArrayStudent));
            Console.ReadKey();

        }
示例#2
0
 public int Students_number(Student[] ArrayStudent)
 {
     int i = 0;
     while (ArrayStudent[i] != null)
     {
         i++;
     }
     return i;
 }