// 7. static Hallgato[] HallgatokTagozaton(Hallgato[] hallgatok, Tagozatok tagozat, int limit) { int db = 0; for (int i = 0; i < hallgatok.Length; i++) { if (hallgatok[i].Tagozat == tagozat) // enum == enum működik { if (hallgatok[i].Szuletes.Year <= 1990) { db++; } } } Hallgato[] elemek = new Hallgato[db]; db = 0; //indexelőnek használva innentől for (int i = 0; i < hallgatok.Length; i++) { if (hallgatok[i].Tagozat == tagozat) { if (hallgatok[i].Szuletes.Year <= 1990) { elemek[db++] = hallgatok[i]; } } } return(elemek); }
// 7. static void HallgatokTagozaton(Hallgato[] hallgatok, Tagozatok tagozat, int limit) { Console.WriteLine("{0} tagozatra járó hallgatók:\n", tagozat); for (int i = 0; i < hallgatok.Length; i++) { if (hallgatok[i].Tagozat == tagozat) // enum == enum működik { Console.WriteLine("{0} ({1})", hallgatok[i].Nev, hallgatok[i].NeptunKod); } } }
// 8. static void HallgatokTagozatonPassziv(Hallgato[] hallgatok, Tagozatok tagozat, Iskola iskola) { Console.WriteLine("{0}, {1} tagozatra járó hallgatók:\n", iskola.Nev, tagozat); for (int i = 0; i < hallgatok.Length; i++) { if (hallgatok[i].Tagozat == tagozat) { if (hallgatok[i].Iskola.Nev == iskola.Nev) { Console.WriteLine("{0} ({1})", hallgatok[i].Nev, hallgatok[i].NeptunKod); } } } }
// 8. static Hallgato[] HallgatokTagozatonPassziv(Hallgato[] hallgatok, Tagozatok tagozat, Iskola iskola) { int db = 0; for (int i = 0; i < hallgatok.Length; i++) { if (hallgatok[i].Tagozat == tagozat) { if (hallgatok[i].Iskola.Nev == iskola.Nev) { if (hallgatok[i].PasszivFelevekSzama > 1) { db++; } } } } Hallgato[] elemek = new Hallgato[db]; db = 0; for (int i = 0; i < hallgatok.Length; i++) { if (hallgatok[i].Tagozat == tagozat) { if (hallgatok[i].Iskola.Nev == iskola.Nev) { if (hallgatok[i].PasszivFelevekSzama > 1) { elemek[db++] = hallgatok[i]; } } } } return(elemek); }
// EGYÉB METÓDUSOK public void Beiratkozas(Tagozatok tagozat) { this.tagozat = tagozat; }