1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
| namespace Gestion_Biblio
{
public class Bilbiotheque
{
// ArrayList clivre = new ArrayList();
// ArrayList personne = new ArrayList();
private ArrayList livres;
private ArrayList personnes;
//constructeur
// public Bilbiotheque() { }
public Bilbiotheque()
{
this.livres=new ArrayList();
this.personnes=new ArrayList();
}
//AJOUTER UN LIVRE DANS LA COLLECTION
public void Ajout(Livre l)
{
if(l!=null)
this.livres.Add(l);
}
//AJOUT UNE PERSONNE DANS LA COLLECTION
public void InscritPersonne(Personne p)
{
if(p!=null)
this.personnes.Add(p);
}
//RECHERCHER UN LIVRE
public Livre RechercheLivre(string isbn)
{
foreach (Livre l in livres)
{
if (l.Isbn == isbn) { return l; }
}
return null;
}
/* public bool isBookAvailable(string isbn,bool dispo)
{
RechercheLivre(isbn);
return dispo ;
}*/
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Gestion_Biblio
{
public class Livre
{//attributs
private string isbn;
private string titre;
private string auteur;
private int nbpages;
private bool dispo;
/* public Livre()
{
}*/
//Contructeur par defaut
public Livre()
{
dispo = true;//le livre est dispo par defaut
}
//Constructeur Value
public Livre(string isbn1, string titre1, string auteur1, int nbpages1)
{
isbn = isbn1;
titre = titre1;
auteur = auteur1;
nbpages = nbpages1;
dispo = true;
}
//PROPRIETES
public string Isbn
{
get { return isbn; }
set { isbn = value; }
}
public string Titre
{
get { return titre; }
set { titre = value; }
}
public String Auteur
{
get { return auteur; }
set { auteur = value; }
}
public int Nbpages
{
get { return nbpages; }
set { nbpages = value; }
}
public bool Dispo
{
get { return dispo; }
set { dispo = value; }
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Gestion_Biblio
{
public class Personne
{
private string nom;
private string prenom;
/* public Personne()
{ }*/
//Constructeur
public Personne() { }
public Personne(string nom, string prenom)
{
this.nom = nom;
this.prenom = prenom;
}
//PERMET DE RETOURNER LES INFOS DE PERSONNE
public string PresenteToi()
{
return " Je m'appelle" + this.prenom + " " + this.nom;
//ou string.Format("Je m'appelle{0} {1",prenom,nom);
}
//PROPRIETE EN LECTURE SEULE
public string Nom
{
get {return this.nom;}
}
public string Prenom
{
get {return this.prenom;}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Gestion_Biblio
{
class Program
{
static void Main(string[] args)
{
int isbn;
string i;
//string dispo;
// string prenom;
Livre L1 = new Livre();
//Console.ReadLine();
//Console.WriteLine("veuillez entrez les coordonnees svp: ");
Personne P2 = new Personne();
Console.WriteLine(P2.PresenteToi().ToString());
//Console.ReadLine();
Bilbiotheque B1 = new Bilbiotheque();
B1.Ajout(L1);
Console.ReadLine();
B1.InscritPersonne(P2);
Console.WriteLine(B1);
Console.ReadLine();
/* Console.WriteLine("Veuillez entrer le code svp:");
L1.Isbn = isbn.ToString();
i = isbn.ToString();
B1.RechercheLivre(i);
// B1.isBookAvailable(isbn);*/
Console.ReadLine();
}
}
} |