Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
02873d405b |
@@ -110,7 +110,7 @@ public class LivreValide {
|
||||
i++;
|
||||
System.out.println(i+". "+unLivre.getTitre());
|
||||
}
|
||||
System.out.print("Merci de faire votre choix : ");
|
||||
System.out.print("Merci de faire le choix du livre à restituer: ");
|
||||
int choix = sc.nextInt();
|
||||
Livre leLivre = user.getEmprunts().get(choix-1);
|
||||
|
||||
|
@@ -10,6 +10,7 @@ package com.mycompany.bibliotheque;
|
||||
*/
|
||||
|
||||
|
||||
import com.mycompany.bibliotheque.Controle.LivreValide;
|
||||
import com.mycompany.bibliotheque.Metier.Bibliotheque;
|
||||
import com.mycompany.bibliotheque.Metier.Emprunt;
|
||||
import com.mycompany.bibliotheque.Metier.Utilisateur;
|
||||
@@ -24,14 +25,16 @@ public class GestionBibliotheque {
|
||||
Bibliotheque laBibli = new Bibliotheque();
|
||||
ArrayList<Livre> mesLivres = new ArrayList<>();
|
||||
Livre l1 = new Livre("Le secret des secrets","Dan Brown","9782709668385",true);
|
||||
//Utilisateur u1 = new Utilisateur("Alice", mesLivres.add(l1));
|
||||
mesLivres.add(l1);
|
||||
Utilisateur u1 = new Utilisateur("Alice", mesLivres);
|
||||
|
||||
System.out.println("Bienvenue dans la bibliothèque !");
|
||||
while (choix!=4){
|
||||
System.out.println("1. Afficher un livre");
|
||||
System.out.println("2. Ajouter un livre");
|
||||
System.out.println("3. Afficher les livres");
|
||||
System.out.println("4. Quitter");
|
||||
System.out.println("4. Restituer un livre");
|
||||
System.out.println("5. Quitter");
|
||||
System.out.print("Merci de faire votre choix : ");
|
||||
choix = sc.nextInt();
|
||||
switch (choix) {
|
||||
@@ -46,6 +49,21 @@ public class GestionBibliotheque {
|
||||
System.out.println("---"+leLivre.toString());
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
boolean restitution = LivreValide.retourLivre(u1);
|
||||
String message = "";
|
||||
|
||||
if (restitution) {
|
||||
message += "Le livre a été restitué !\n";
|
||||
message += "\\nVous avez désormais "+u1.getEmprunts().size()+" livres empruntés sur 3 !\n";
|
||||
message += "Merci, "+u1.getNom()+", d'avoir emprunté chez nous !";
|
||||
|
||||
} else {
|
||||
message += "Le livre n'a pas été restitué.";
|
||||
}
|
||||
|
||||
System.out.println(message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user