import java.util.ArrayList; import java.util.Scanner; /** * The class Execute is the executen file for the whole programm. */ public class Execute { public static void main(String[] args) { Datei datei = new Datei("users.txt"); User[] user = datei.laden(); for (User user1 : user) { System.out.println(user1); } System.out.println(); System.out.println("\t\t\tANMELDUNG"); int i = 0; Scanner leser = new Scanner(System.in); while (true) { System.out.print("Name: "); boolean error = false; String name = leser.nextLine(); if(name.isEmpty()){ error = true; } System.out.print("Passwort: "); String password = leser.nextLine(); if(password.isEmpty()){ error = true; } for (User user1 : user) { if (!error) { if (user1.getPassword().equals(password) && user1.getPhonenumber().equals(name)) { System.out.println(); System.out.println("Herzlich Willkommen " + user1.getNameParent1() + " und " + user1.getNameParent2() + ", Ihr Login war erfolgreich!"); i++; break; } else if (!(user1.getPassword().equals(password) && user1.getPhonenumber().equals(name))) { System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); break; } }else{ System.out.println("Bitte Anmeldedaten angeben."); break; } } if (i > 0) { break; } } } }