From 12a8806fb6931410769c8aca675705656c4eea14 Mon Sep 17 00:00:00 2001 From: Kevin Pfannenstiel Date: Wed, 21 Dec 2022 17:01:06 +0100 Subject: [PATCH] =?UTF-8?q?Login=20ist=20jetzt=20auf=20english=20und=20kom?= =?UTF-8?q?mentare=20wurden=20erg=C3=A4nzt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- out/production/VPR_SCRIPT/Execute.class | Bin 2540 -> 2309 bytes .../VPR_SCRIPT/GeneralMethods.class | Bin 1420 -> 1420 bytes src/Execute.java | 20 ++++-------- src/GeneralMethods.java | 8 ----- src/Login.java | 30 +++++++++++++++++- 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/out/production/VPR_SCRIPT/Execute.class b/out/production/VPR_SCRIPT/Execute.class index 4911859f78c42f82de6716e04548939a8e73993a..659f00625add2f2df3f8fe43dd6a9e3c8a72e168 100644 GIT binary patch delta 410 zcmXAkyDx)b6vlsV+pljm4cb~dh{0VoB-UCC(!pYo2z75uU0S`Mu8qM|+h>(@G-^bN zfkh&bAh9yA`wK|K`E)ra?{m)kJJ0jwKk~UBe{XJqL5daky(6fZ^bp0XaAo6jv9Vk{ z>t={)4>QavbUrH`NZ(caBt{St75s!RlQz*%L=A~~=~2?FM& zYoOT5Hf+XLNH;57z{_qn8IlJd3F}`u}f7<(`*umRZ4WU1F6r>26+0 zkrp2fJh4tjVwD&rE1F&C5pv|kL76ZcY+^(N-^>;TiS|srm?=oS9YI;~YLH!l?1|#T V{)<X+N4x+4 delta 616 zcmXAm%TH556vltk*Obx#ZDV2+Di;wgDlJKkZg4|VS0*lq#y|yYx!e}ZE%brntBB$w z?5rDIv6H1}QjH5qjERX0^e-@Rnp%FZ{%}l+mTgmZixnNrgU8tnz7plt&cYJ8VPgapQTe1qaF>B_F zmRZT=i&@LG6UGIzT&d;qrfrNDOv9`gX4y7t)kFYIF31cag}-cOXUrgIHnm zijH)_E|x4|QH;hL-@W@9UEa8wdwt5gsN9-bW7F4{Dc};{2r9hz1g}b#l&BMh|;C8H1r6!626=8{M@{n%T z#dXnjv0mp1H>Btm>BrpUme||iwyZlcvTga~Ix8}p9nOi#6`9YfP&xByliU-M`%+2a o+a;vYnuz+#nLqUG$p`v1YwcnS$24ipq-^LO5t0W!x$ENLe~-I(7ytkO diff --git a/out/production/VPR_SCRIPT/GeneralMethods.class b/out/production/VPR_SCRIPT/GeneralMethods.class index 2332b31ca6f891ff6a46ff71a8405fd7d83ecdd2..d6f395851282dd038579ee4a2322f2aae441e457 100644 GIT binary patch delta 81 zcmeC-?&01L$im1oIfx}fP@I8{L4tvgL6Sj)K^jQPOy12>uc^+!%Amo(!Jx&!%b?95 hz@W<@%Af~SXTTuKV921rV9cP(U;Nn237_G1`Y-z23`hZ j1_1_B22lnx1_=fW23ZD6pn7WtRR$Xd4F>zk$*h_H@i7Y6 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;