Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
2 views
11 pages
TP Corecction
corecction de tp
Uploaded by
zakariaeechrigui
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save TpCorecction For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
2 views
11 pages
TP Corecction
corecction de tp
Uploaded by
zakariaeechrigui
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save TpCorecction For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 11
Search
Fullscreen
On se propose de développer une application Java de gestion de livres, sachant qwun livre est caracténisé par son ID, son ttre et son auteur 1, Créer une interface IMetier définissant les méthodes suivantes : e Ajouter un livre. Chercher un livre par son 1D. © Afficher tous les livres. Supprimer un livre. 2. Créer la classe ImpIMetier implémentant IMétier. 3. Créer une classe de Test. |package smi.collections; public interface IMetier { a void ajouter (MY 1); void supprimer(int id); void afficherLivres(); Livre cherLivreParID(int id); 9} I 10 es ae =x% kaso Seated et Apc Cop Ft ne SHH ne Seat eapOs 0O-R-a- ease ® + 11 public int gettd() { eee ihe 1 return id; Ste 13 } Beenie 14 public String getTitre() { Fmommm 15 return titre; Himeactne 16 } 1p taroome 17 public String getAuteur() { | coro 18 return auteur; 19) = 20-@override poem 21 public String toString() { tet 2 // 1000 Auto-generated method stub a 3 return “Id="+id+":Titre="+titre+! ‘Auteur="*auteur;| 4} 25 private int id; 26 private String titre, auteur; 27} 28 - Erotic 1B Cesuten © concie Xf tem =*% S090 ~0 + Some 7 Apne Po p24 Taye ne BK HFT a yy yea3 public class Livre { public Livre(int id, String titre, String auteur) { 4 s super(); 6 this.id = id; 7 this.titre = titre; 8 this.auteur = auteur; 9 } 1e 11 public int getId() { 12 return id; Jee 13} 14 public String getTitre() { 1s return titre; 16 } 17 public String getAuteur() { 18 return auteur; aay ‘ax ac BE - $ rethems = smasec iG Oecmater Oconee xX §? See Appin] Pega Fae pB 74 epee ne nce 26 TSF pe TE fret ae11 public int getId() { 12 return id; 13} 14 public string getTitre() { 1s return titre; 16 } public String getauteur() { return auteur; @Override public String toString() { // 1000 Auto-generated method stub return “Id="+ide":Titres"+titres" :Auteur="+auteur;| 5 private int id; S private String titre,auteur; ' f Prcalems = images 1B Decnater © Corse Xf te ox e+e © stemmested> Tet (TD ana Appel] C\Progam Fes iw hI" ei premm ene QE now 256 TELS = 152 pe 1526) 7 Snes meet Beepackage smi.collections; * 9 import java.util. ArrayList; import java.util-Hashset; = 5 import java.util. LinkedList; » © import java.util.List; import java.util.set; Be public class ImplMetier implements INetier { Spe 10 public Implmetier() { Sao 1 Livresenew HashSet<>(); ae } = eoverride public void ajouter(Livre 1) { 7/ TODO Auto-generated method stub Livres. add(1);package smi.collections; * 3 import java.util.arraylist; 4 import java.util.Hashset; © 5 import java.util. Linkedtist; s & 6 import java.util.List; 7 ? import java.util.set; 9 public class ImplMetier implements Imetier { 10 public ImplMetier() { un Livressnew Hashsete>(); 12 } override public void ajouter(Livre 1) { // 1000 Auto-generated method stub livres.add(1); + override public void supprimer(int id) { . |: empublic void supprimer(int id) { // YO00 Auto-generated method stub for(int is@;iclivres.size();it+) { if(Livres.contains(this.cherLivreParI0(id))==true) livres.remove((this.cherLivrePar: , d @override public void afficherLivres() { // To00 Auto-generated method stub System.out.printIn( livres); } @override public Livre cherLivreParID(int id), { // T000 auto-generated method stub for(Livre 1:livres) { if(L.getId()=*id) return } wees EEDGOINIY = Der errrAc void supprimer(int id) { // YO00 Auto-generated method stub for(int isO;iclivres.size();it+) { if (Livres. contains (this. cherLivreParID(id)): rue) Livres renove(ithis..cherLivreParID(id)) ; d ride 9 ic void affichertivres() { #30 // TODO Auto-generated method stub min SYStem.out.printIn(livres); rride lic Livre cherLivreParro(int id) { 11 T000 Auto-generated method stub for(Livre l:livres) { if(L.getId()=*id) return 1; recone: CEST SS ee eepublic class Test { public static void main(string[] args) { // 1000 Auto-generated method stud ImplMetier o=new InplNetier(); o.ajouter(new Livre(2,"Algebre","ahnadi"))5 o.ajouter(new Livre(2, "Analyse", "Idrissi"))5 o.ajouter(new Livre(3,"C","Ahmadi")); o.afficherLivres(); Scanner senew Scanner(Systen. in); System.out.printIn("entrer 1'id du livre int n=s.nextInt(); o.suppriner(n); o.afficherLivres(); system.out.printIn("Entrer 1'id du livre 2 int m=s.nextInt(); Livre Iso. cherLivreParID(m); System.out.printIn(1); & supprimer:"); teow ESCO eer eee# 4G import java.util. Iterator; import java.util. List; 7 public class Main { public static void main(string[] args) { // 000 Auto-generated method stub snew ArrayList<>(); ne ha List
h2 al.add(“Lundi"); 3 al.add( Mardi"); 4 al.add(“Nercredi"); Ss al.add(“Jeudi"); Iterator
itersal.iterator(); while(iter.hasNext()) { String seiter.next();] aes
You might also like
Book Dao
PDF
No ratings yet
Book Dao
1 page
CS 1103 - Programming Assignment Unit 6
PDF
No ratings yet
CS 1103 - Programming Assignment Unit 6
9 pages
Library Management System
PDF
No ratings yet
Library Management System
8 pages
Programming Assignment Unit 6
PDF
No ratings yet
Programming Assignment Unit 6
7 pages
Exercice 2 TP Java
PDF
No ratings yet
Exercice 2 TP Java
8 pages
Programming Assignment Unit 6
PDF
No ratings yet
Programming Assignment Unit 6
8 pages
Assignment Activity Unit 5
PDF
No ratings yet
Assignment Activity Unit 5
12 pages
Y G Ysdf SDF SDF SF S Aw A W Dad Yg 9g 99asdf Sadfcassdf As FZXVZXVZV ZV ZV Z XV ZV ZV V Z VZ Sadasdf As DF Asf Asf Saf Fds Af Dasf
PDF
No ratings yet
Y G Ysdf SDF SDF SF S Aw A W Dad Yg 9g 99asdf Sadfcassdf As FZXVZXVZV ZV ZV Z XV ZV ZV V Z VZ Sadasdf As DF Asf Asf Saf Fds Af Dasf
10 pages
Y G Ysdf SDF SDF SF S Aw FGH FH F H F D G D GD GD R A W Dad Yg 9g 99asdf Sadfcassdf As FZXVZXVZV ZV ZV Z XV ZV ZV V Z
PDF
No ratings yet
Y G Ysdf SDF SDF SF S Aw FGH FH F H F D G D GD GD R A W Dad Yg 9g 99asdf Sadfcassdf As FZXVZXVZV ZV ZV Z XV ZV ZV V Z
10 pages
Y G Ysdf SDF SDF SF S Aw FGHGHJ GH MH MH M M GM M G MG FH F H F D G D GD GD R A W Dad Yg 9g 99asdf Sadfcassdf
PDF
No ratings yet
Y G Ysdf SDF SDF SF S Aw FGHGHJ GH MH MH M M GM M G MG FH F H F D G D GD GD R A W Dad Yg 9g 99asdf Sadfcassdf
10 pages
ZXZX
PDF
No ratings yet
ZXZX
10 pages
VFVFDV
PDF
No ratings yet
VFVFDV
11 pages
Y G Ysdf SDF SDF SF S Aw Fghghjef Esf Sef Fseaefasef F Ef SF F E Fe S F Esf Es Fe Ef Af W Ad WD Awd WD E Q W
PDF
No ratings yet
Y G Ysdf SDF SDF SF S Aw Fghghjef Esf Sef Fseaefasef F Ef SF F E Fe S F Esf Es Fe Ef Af W Ad WD Awd WD E Q W
11 pages
E Fefefee Fe
PDF
No ratings yet
E Fefefee Fe
11 pages
Java
PDF
No ratings yet
Java
15 pages
Solution TD Java 4-8
PDF
No ratings yet
Solution TD Java 4-8
30 pages
Creating Library App
PDF
No ratings yet
Creating Library App
7 pages
Fop 2 2 Variant Solution
PDF
No ratings yet
Fop 2 2 Variant Solution
10 pages
Library
PDF
No ratings yet
Library
2 pages
java-TP6 - Final
PDF
No ratings yet
java-TP6 - Final
4 pages
Programming Assignment Unit 6
PDF
No ratings yet
Programming Assignment Unit 6
14 pages
Worksheet Template-Java Programming 2
PDF
No ratings yet
Worksheet Template-Java Programming 2
5 pages
Compte Rendu TP5
PDF
No ratings yet
Compte Rendu TP5
8 pages
Assigment 8
PDF
No ratings yet
Assigment 8
7 pages
Programming Assingment Unit. 2
PDF
No ratings yet
Programming Assingment Unit. 2
6 pages
SolTD 2
PDF
No ratings yet
SolTD 2
5 pages
Lab Test
PDF
No ratings yet
Lab Test
5 pages
Main Java
PDF
No ratings yet
Main Java
2 pages
Vansh Bhure IT Class 12
PDF
No ratings yet
Vansh Bhure IT Class 12
17 pages
Group Alibasa X Abilul X Hajihil X Lauerano
PDF
No ratings yet
Group Alibasa X Abilul X Hajihil X Lauerano
21 pages
JAVA OOP Questions (Hashmap and Hashsets)
PDF
No ratings yet
JAVA OOP Questions (Hashmap and Hashsets)
2 pages
Guide Pas A Pas Bibliotheque Java
PDF
No ratings yet
Guide Pas A Pas Bibliotheque Java
13 pages
Hands On - Collection, Generics and Stream API
PDF
No ratings yet
Hands On - Collection, Generics and Stream API
6 pages
Book Class With Getters Setters
PDF
No ratings yet
Book Class With Getters Setters
3 pages
Hash Set Example
PDF
No ratings yet
Hash Set Example
1 page
Library System
PDF
No ratings yet
Library System
4 pages
Java Adi
PDF
No ratings yet
Java Adi
7 pages
Library Management
PDF
No ratings yet
Library Management
3 pages
Library Managent
PDF
No ratings yet
Library Managent
19 pages
Manrique & Mejias Exercise2
PDF
No ratings yet
Manrique & Mejias Exercise2
4 pages
Java Handson
PDF
No ratings yet
Java Handson
17 pages
Java Collection
PDF
No ratings yet
Java Collection
9 pages
Class Book
PDF
No ratings yet
Class Book
11 pages
Lab 7 Hoh Jia Da: //librarybook Class
PDF
No ratings yet
Lab 7 Hoh Jia Da: //librarybook Class
3 pages
SyedAmielMateenbinSyedAdrinPutra ITS63304
PDF
No ratings yet
SyedAmielMateenbinSyedAdrinPutra ITS63304
26 pages
Youlong FinalExam
PDF
No ratings yet
Youlong FinalExam
7 pages
LAB # 5 REPORT Waleed Khalid (OOP)
PDF
No ratings yet
LAB # 5 REPORT Waleed Khalid (OOP)
16 pages
Java 1
PDF
No ratings yet
Java 1
7 pages
AOOP
PDF
No ratings yet
AOOP
5 pages
Poo 1 Best Selling
PDF
No ratings yet
Poo 1 Best Selling
3 pages
P3
PDF
No ratings yet
P3
3 pages
Unit 6 Assignment Generic Library
PDF
No ratings yet
Unit 6 Assignment Generic Library
30 pages
MICRO Report
PDF
No ratings yet
MICRO Report
22 pages
Book
PDF
No ratings yet
Book
2 pages
MId Sem Java Anser
PDF
No ratings yet
MId Sem Java Anser
4 pages
OOP (JAVA) Project
PDF
No ratings yet
OOP (JAVA) Project
17 pages
Programmation Java
PDF
No ratings yet
Programmation Java
4 pages