retourLivre géré non testé
This commit is contained in:
@@ -5,6 +5,8 @@
|
|||||||
package com.mycompany.bibliotheque.Controle;
|
package com.mycompany.bibliotheque.Controle;
|
||||||
|
|
||||||
import com.mycompany.bibliotheque.Metier.Livre;
|
import com.mycompany.bibliotheque.Metier.Livre;
|
||||||
|
import com.mycompany.bibliotheque.Metier.Utilisateur;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe de contrôle de la classe Livre
|
* Classe de contrôle de la classe Livre
|
||||||
@@ -93,4 +95,26 @@ public class LivreValide {
|
|||||||
}
|
}
|
||||||
return valide;
|
return valide;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IsDisponible()
|
||||||
|
* Vérifier livre pas déjà emprunté
|
||||||
|
* @author Morgann/Emile
|
||||||
|
*/
|
||||||
|
public static boolean retourLivre(Utilisateur user){
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
int i=0;
|
||||||
|
for(Livre unLivre:user.getEmprunts()){
|
||||||
|
i++;
|
||||||
|
System.out.println(i+". "+unLivre.getTitre());
|
||||||
|
}
|
||||||
|
System.out.print("Merci de faire votre choix : ");
|
||||||
|
int choix = sc.nextInt();
|
||||||
|
Livre leLivre = user.getEmprunts().get(choix-1);
|
||||||
|
|
||||||
|
leLivre.setEmprunte(false);
|
||||||
|
user.getEmprunts().remove(leLivre);
|
||||||
|
return leLivre.isEmprunte();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user