diff --git a/out/production/VPR_SCRIPT/Execute.class b/out/production/VPR_SCRIPT/Execute.class index 4911859..659f006 100644 Binary files a/out/production/VPR_SCRIPT/Execute.class and b/out/production/VPR_SCRIPT/Execute.class differ diff --git a/out/production/VPR_SCRIPT/GeneralMethods.class b/out/production/VPR_SCRIPT/GeneralMethods.class index 2332b31..d6f3958 100644 Binary files a/out/production/VPR_SCRIPT/GeneralMethods.class and b/out/production/VPR_SCRIPT/GeneralMethods.class differ diff --git a/src/Execute.java b/src/Execute.java index 06c0bd9..1d4415a 100644 --- a/src/Execute.java +++ b/src/Execute.java @@ -26,6 +26,12 @@ public class Execute { + "1: Nitrit-Pökelsalz; 2: Phosphat; 3: Nitrat; 4: Antioxidationsmittel; 5: Farbstoff;\n" + "6: Geschmacksverstärker; 7: Süßungsmittel; 8: Konservierungsstoff"); + /** + * In the Login-Area the user can type the phonenumber and the password to login. + * In the Background, the class Login checks the input and return whether the login was correct or not. + * + * @author Kevin Pfannenstiel + */ System.out.println(""); System.out.println("____________________________LOGIN_______________________________"); Data userData = new Data("user.txt"); @@ -38,18 +44,6 @@ public class Execute { System.out.print("Passwort: "); String password = leser.nextLine(); - while(password.isEmpty() || phoneNumber.isEmpty()) - { - System.out.println("Login fehlgeschlagen. Versuchen Sie es erneut."); - System.out.println(""); - System.out.print("Telefonnummer: "); - phoneNumber = leser.nextLine(); - System.out.print("Passwort: "); - password = leser.nextLine(); - } - - login.Einloggen(userData.readUser(), password, phoneNumber); - - + login.toLogin(userData.readUser(), password, phoneNumber); } } diff --git a/src/GeneralMethods.java b/src/GeneralMethods.java index e576d1f..f4fd82b 100644 --- a/src/GeneralMethods.java +++ b/src/GeneralMethods.java @@ -1,14 +1,6 @@ -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; import java.time.DayOfWeek; import java.time.LocalDate; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.List; import java.util.Locale; /** diff --git a/src/Login.java b/src/Login.java index aa6ec90..4f3c92a 100644 --- a/src/Login.java +++ b/src/Login.java @@ -2,7 +2,17 @@ import java.util.ArrayList; import java.util.Scanner; public class Login { - public void Einloggen(ArrayList user, String password, String phoneNumber) { + /** + * The method toLogin() compares the phonenumber and password of the user with the phonenumber and password + * from the user.txt + * + * @param user all users are in a list + * @param password password of the user + * @param phoneNumber phonenumber of the user + * @return void + * @author Kevin Pfannenstiel + */ + public void toLogin(ArrayList user, String password, String phoneNumber) { Scanner leser = new Scanner(System.in); @@ -11,6 +21,16 @@ public class Login { while (true) { + while(password.isEmpty() || phoneNumber.isEmpty()) + { + System.out.println("Login fehlgeschlagen. Eingabe ist leer, versuchen Sie es erneut."); + System.out.println(""); + System.out.print("Telefonnummer: "); + phoneNumber = leser.nextLine(); + System.out.print("Passwort: "); + password = leser.nextLine(); + } + boolean error = false; error = isError(error, phoneNumber); @@ -41,6 +61,14 @@ public class Login { } } + /** + * The method getDayNumberNew() checks if the phonenumber-input is empty. + * + * @param error is a boolean + * @param phoneNumber is the input of the user + * @return the boolean error + * @author Madeleine Vigier + */ public boolean isError(boolean error, String phoneNumber) { if (phoneNumber.isEmpty()) { error = true;