Esempio n. 1
0
 public void addStudent(Student student)
 {
     if (this.Size < MAX_SIZE - 1)
     {
         this._size += 1;
         this.list[this.Size] = student;
     }
     else
     {
         Console.WriteLine("List is full");
     }
 }
        private static void AddOrCreate(this SortedDictionary<Course, OrderedBag<Student>> dictionary, string courseName, params string[] studentNames)
        {
            var course = new Course(courseName);
            var student = new Student(studentNames[0], studentNames[1]);

            if (!dictionary.ContainsKey(course))
            {
                dictionary[course] = new OrderedBag<Student>();
            }

            dictionary[course].Add(student);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Student Vasya = new Student("Vasya", "Galeev");
            Student Marsel = new Student("Marsel", "Sidikov");
            Student Ranis = new Student("Ranis", "Nigmatullin");

            Vasya.fillMarks(99, 99, 99, 99);
            Vasya.calcAverage();
            Marsel.fillMarks(1, 2, 4, 7);
            Marsel.calcAverage();
            Marsel.print();
            Ranis.fillMarks(20, 50, 70, 50);
            Ranis.calcAverage();

            ArrayList list = new ArrayList();
            //ArrayList sortedList = new ArrayList();
            list.addStudent(Vasya);
            list.addStudent(Marsel);
            list.addStudent(Ranis);

            //sortedList = ArrayList.sortSelection(list);
            list.Swap(Vasya, Ranis);
            list.print();

            Console.ReadLine();
        }
Esempio n. 4
0
 public void Swap(Student a, Student b)
 {
     Student tmp;
     tmp = a;
     a = b;
     b = tmp;
 }