-
-
Save uncoded-ro/2d873778e488de546bfc43e91f1e3695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ro.virtualcampus.app; | |
import ro.virtualcampus.person.Student; | |
import ro.virtualcampus.unit.Facultate; | |
import java.util.Map.Entry; | |
import ro.virtualcampus.map.CatalogMap; | |
public class AppMap { | |
public static void main(String[] args) { | |
Facultate etti = new Facultate("ETTI", "Vasile Parvan nr. 2"); | |
CatalogMap tst3 = new CatalogMap("3 TST"); | |
CatalogMap ea3 = new CatalogMap("3 EA"); | |
Student s1; | |
tst3.getStudenti().put("LK53425", s1 = new Student("Irina Popescu", 22, etti, 3)); | |
tst3.getStudenti().put("LK32425", new Student("Vlad Bucur", 23, etti, 3)); | |
ea3.getStudenti().put("LK12352", new Student("Mihai Voda", 25, etti, 4)); | |
ea3.getStudenti().put("LK98594", new Student("Bogdan Cornu", 24, etti, 4)); | |
tst3.transferStudenti(ea3.getStudenti()); | |
ea3.getStudenti().clear(); | |
tst3.afisareStudenti(); | |
if (tst3.getStudenti().remove("LK53425") != null) | |
System.out.println("studentul " + s1.getNume() + " a fost exmatriculat"); | |
else | |
System.out.println("studentul " + s1.getNume() + " nu poate fi exmatriculat"); | |
System.out.println("parcurgere studenti folosind for-each"); | |
for(Entry<String, Student> student: tst3.getStudenti().entrySet()) | |
System.out.println(student.getKey() + " " + student.getValue()); | |
if (tst3.getStudenti().containsKey("LK12352")) | |
System.out.println("studentul " + tst3.getStudenti().get("LK12352").getNume() + | |
" nu a absolvit inca"); | |
if (!tst3.getStudenti().isEmpty()) | |
System.out.println("nu se recomanda desfintarea anului de studiu " + | |
tst3.getAnStudiu()); | |
tst3.getStudenti().clear(); | |
tst3.afisareStudenti(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment