From a975ac1d335e84708deb452c7bc469772819317f Mon Sep 17 00:00:00 2001 From: Simoes Lukas Date: Wed, 26 Nov 2025 13:53:03 +0100 Subject: [PATCH] TP for mathias PLACIDE--CONTRERAS LUKAS= GROS BG --- .../Authentification.class | Bin 2705 -> 2871 bytes .../02_Authentification/Authentification.java | 28 +- reponses_tp3.txt | 347 ++++++++++++++++++ 3 files changed, 366 insertions(+), 9 deletions(-) create mode 100644 reponses_tp3.txt diff --git a/DEV3.2/TP08/02_Authentification/Authentification.class b/DEV3.2/TP08/02_Authentification/Authentification.class index 233968ed9b38ab1083101b2f4f5b5a4390b8a032..a94c555a9cd21c6faeff933825b84fcb3eebc8cf 100644 GIT binary patch delta 1419 zcmbOzx?QaP)W2Q(7#JAL8D?@Z=rB02GdOZFFfllAG6*p^aWgnGxNtJKGPnsbFfe#= zF?cihfW&+`82p477#Y0S83MQ%co+gX7=nZtm>9f3k|9D2%pjRCE(RfxdEx8~5g;=n zxfnzlqPQ4D7@|2CVmKILIT+%&80@_n;z42w91Mvdqmnonl0h0%I2ckvbQ%XkI*88T zV8~==$O0LZ&B2hv&XCK&kjKuDzj2cqBV)njJB;c&h73lG41!sSWr_NwC7C(;9*M;n zzKI1q47v<@>|$iR|VT9U!TU;$z?r=;faFjz8JP1a&IWbR`qn;ge18KQx3 zhGS7tVx?zZN@|6FX^DTDQ+{b)O0jE2a%w?IW_}(cgOF=c5y%@U>WM|^rManjCB-P- z@K4H0O)g<%5T1OHQF!u3<|5{Ph6$6^SYA)w!m2n~kaaN|Ye7+FUdiOktYJLNsYONX z3==_NHg&QsnLL%NlBJVPMhT$-v6Q zaEw7{69b#}E(Uf6hHVTS%NfMMaymO1IGGv3H!-jYacyJZ*a)@|WV{#yD+2=qKLam= z0D}yJ5Q7GTFoOYuD1$iz14BIv1Cxv}10yJWp*GetFoA9K0GkT7@i@#zZm5lV2)P3c zJUZJLcxN&2fo$djJBT0RK7O!jghQkl*cccXBp7%ZBpGBFq!h4y1Vu5(HIuh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!J46o!Iq(m!JeU)!I@zKgCoO41}BD@ z3@+fXQDorw#~{njz|YPg$j)H-hrxoK!Ae~C7X$k*1}1wab_P`r24)6pa5A!C=mV!r jMur}S2@Jgqk_;{k3=C2XEDWv;j0|pI(i=?rf=Pb>Rrkyp diff --git a/DEV3.2/TP08/02_Authentification/Authentification.java b/DEV3.2/TP08/02_Authentification/Authentification.java index d8b1b03..7bd5462 100644 --- a/DEV3.2/TP08/02_Authentification/Authentification.java +++ b/DEV3.2/TP08/02_Authentification/Authentification.java @@ -16,13 +16,14 @@ public class Authentification { System.out.println("L'utilisateur '" + username + "' existe déjà."); } else { this.dictionnaire.put(username, password); + System.out.println("Utilisateur ajouté."); } } public void authentifier(String username, String password) { if (this.dictionnaire.get(username) == null) { System.out.println("L'utilisateur '" + username + "' n'existe pas."); - } else if (this.dictionnaire.get(username) != password) { + } else if (!this.dictionnaire.get(username).equals(password)) { System.out.println("Le mot de passe est incorrect."); } else { System.out.println("L'utilisateur '" + username + "' est authentifié."); @@ -43,28 +44,37 @@ public class Authentification { BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); - try { - String input = ""; + String input = ""; + + while (!input.equals("quit")) { + + System.out.print("> "); + + try { - while (!input.equals("quit")) { String[] ligne = console.readLine().split(" "); input = ligne[0]; - System.out.print("> "); + + if (input.equals("add")) { auth.ajouter(ligne[1], ligne[2]); } else if (input.equals("auth")) { auth.authentifier(ligne[1], ligne[2]); } else if (input.equals("del")) { auth.supprimer(ligne[1]); + } else if (input.equals("quit")) { + } else { System.out.println("Commande non reconnue."); } - } - } catch (IOException e) { - System.err.println("Erreur de la console"); - } + } catch (IOException e) { + System.err.println("Erreur de la console"); + } catch (ArrayIndexOutOfBoundsException e1) { + System.err.println("Erreur d'arguments"); + } + } } } \ No newline at end of file diff --git a/reponses_tp3.txt b/reponses_tp3.txt new file mode 100644 index 0000000..e6edd89 --- /dev/null +++ b/reponses_tp3.txt @@ -0,0 +1,347 @@ +----- TP03 ----- + +1. + + + + + + + CEastwood + + + + +

Mes films préférés de Clint Eastwood

+
    +
  • Gran Torino (2008)
  • +
  • Impitoyable (1992)
  • +
  • Mystic River (2003)
  • +
  • Sur la route de Madison (1995)
  • +
  • Lettres d'Iwo Jima (2006)
  • +
  • L'Échange (2008)
  • +
  • Josey Wales hors-la-loi (1976)
  • +
  • Breezy (1973)
  • +
+ + + +2. + + + + + + + Exercice 2 + + + +
+
+
+ +
+
+ + + + +3. + + + + + + Exercice 3 + + + +
    +
  • +
  • +
  • +
+ + + + +4. + + + + + + + + + Document + + + + +
+ +
+
+
+
+

Article title 1

+
+
+ +

lorem ipsum

+
+
+
+
+

Article title 2

+
+
+ +

lorem ipsum

+
+
+
+
+

Article title 3

+
+
+ +

lorem ipsum

+
+
+
+
+

Article title 3

+
+
+ +

lorem ipsum

+
+
+
+ + + + + +5. + + + + + + + + + Document + + + + +
+ +
+
+
+
+

Article title 1

+
+
+ +

lorem ipsum

+
+
+
+
+

Article title 2

+
+
+ +

lorem ipsum

+
+
+
+
+

Article title 3

+
+
+ +

lorem ipsum

+
+
+
+
+

Article title 3

+
+
+ +

lorem ipsum

+
+
+
+ +