Exemplo n.º 1
0
        public static int sumOfNotes(Abiturient ab)
        {
            int sum = 0;

            for (int j = 0; j < ab.Notes.Length; j++)
            {
                sum += ab.Notes[j];
            }
            return(sum);
        }
Exemplo n.º 2
0
 public static void sortByNotes(AbiturientList abiturients, int inputNote)
 {
     Abiturient[] sortedAbitur = abiturients.Abiturients;
     for (int abit1 = 0; abit1 < sortedAbitur.Length; abit1++)
     {
         for (int abit2 = abit1; abit2 < sortedAbitur.Length; abit2++)
         {
             if (sumOfNotes(sortedAbitur[abit1]) < sumOfNotes(sortedAbitur[abit2]))
             {
                 Abiturient buf = sortedAbitur[abit1];
                 sortedAbitur[abit1] = sortedAbitur[abit2];
                 sortedAbitur[abit2] = buf;
             }
         }
     }
 }
Exemplo n.º 3
0
 public static void getAbiturientsFromConsole(Abiturient[] abiturients)
 {
     for (int i = 0; i < abiturients.Length; i++)
     {
         Console.WriteLine(i + " Abiturient:");
         Console.WriteLine("Input name (e.g. Anna Lisa Egorovna):");
         string name = Console.ReadLine();
         Console.WriteLine("Input num of notes:");
         int[] notes = new int[getINT()];
         for (int j = 0; j < notes.Length; j++)
         {
             Console.WriteLine("Input note " + j + ":");
             notes[j] = getINT();
         }
         Console.WriteLine("Get Adress:");
         string adress = Console.ReadLine();
         abiturients[i] = new Abiturient(name.Split(new Char[] { ' ' }), notes, adress);
     }
 }