Example #1
0
 public void SetStudents(int numStudents)
 {
     Console.WriteLine();
     Students = new Student[numStudents];
     for (int i = 0; i < numStudents; i++)
     {
         Students[i] = new Student();
         Students[i].SetNumber(Questions.AskForString("Student Number"));
         Students[i].SetName(Questions.AskForString("Student Name"));
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            int C;
            bool T = true;
            Course C1 = new Course(); C = C1.GetCourseInfo();
            Console.WriteLine();
            Student[] arraylistofStudents = new Student[C];


            while (T == true)
            {

                for (int i = 0; i < C; i++)
                {
                    arraylistofStudents[i] = new Student();
                    Console.Write("Student Name:");
                    arraylistofStudents[i].SName = Console.ReadLine();
                    Console.Write("Student Number:");
                    arraylistofStudents[i].SNumber = int.Parse(Console.ReadLine());
                    Console.WriteLine();
                }
                System.Console.Write(" Would you like to start again enter true or false? ");
                T = bool.Parse(Console.ReadLine());
                Console.WriteLine();
            }

            Console.WriteLine("+-----------------------------------------------+");
            C1.PrintCourseInfo();
            Console.WriteLine("+-----------------------------------------------+");
            Console.WriteLine();


            for (int i = 0; i < C; i++)
            {
                Console.WriteLine("+-----------------------------------------------+");
                Console.Write("Student Name: " + arraylistofStudents[i].SName + ", ");
                Console.WriteLine("Student Number: " + arraylistofStudents[i].SNumber);
                Console.WriteLine("+-----------------------------------------------+");
            }

            Console.Write("Press Enter to finish...");
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Student s1 = new Student(), s2 = new Student(), s3 = new Student();
            Teacher t1 = new Teacher();
            Course ProgrammingWithCSharp = new Course("Programming with C#");

            ProgrammingWithCSharp.AddStudent(s1);
            ProgrammingWithCSharp.AddStudent(s2);
            ProgrammingWithCSharp.AddStudent(s3);

            ProgrammingWithCSharp.AddTeacher(t1);

            Degree Bachelor = new Degree("Bachelor");
            Bachelor.AddCourse(ProgrammingWithCSharp);

            UProgram InformationTechnology = new UProgram("Information Technology");
            InformationTechnology.AddDegree(Bachelor);

            Console.WriteLine("The " + InformationTechnology.name + " program contains the " + InformationTechnology.degree.name + " of Sciense degree\n");
            Console.WriteLine("The " + InformationTechnology.degree.name + " of Sciense degree contains the course " + InformationTechnology.degree.course.name + "\n");
            Console.WriteLine("The " + InformationTechnology.degree.course.name + " course contains " + Student.TrackStudent.student_num + " student<s>");
            Console.ReadLine();
        }
 public void AddStudent(Student s)
 {
     if (student_num >= SIZE)
         throw new IndexOutOfRangeException("Number of students can't be more than 3");
     arr_student[student_num++] = s;
 }