|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using Model;
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
|
|
namespace MyProject;
|
|
|
|
|
class Program
|
|
|
|
@ -16,7 +17,7 @@ class Program
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Menus principal");
|
|
|
|
|
Console.WriteLine("1- Les espèces");
|
|
|
|
|
Console.WriteLine("2- Le animaux");
|
|
|
|
|
Console.WriteLine("2- Vos animaux");
|
|
|
|
|
Console.WriteLine("9- Quitter");
|
|
|
|
|
|
|
|
|
|
Console.Write("Entrer votre choix : ");
|
|
|
|
@ -51,6 +52,7 @@ class Program
|
|
|
|
|
switch (choix)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
afficherEspece();
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
return;
|
|
|
|
@ -64,7 +66,7 @@ class Program
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Menus des animaux");
|
|
|
|
|
Console.WriteLine("1- Afficher les animaux");
|
|
|
|
|
Console.WriteLine("2- ");
|
|
|
|
|
Console.WriteLine("2- Ajouter des animaux");
|
|
|
|
|
Console.WriteLine("9- Quitter");
|
|
|
|
|
|
|
|
|
|
Console.Write("Entrer votre choix : ");
|
|
|
|
@ -73,6 +75,10 @@ class Program
|
|
|
|
|
switch (choix)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
|
|
|
|
afficherAnimaux();
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ajouterAnimaux();
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
|
|
|
|
return;
|
|
|
|
@ -82,6 +88,67 @@ class Program
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void afficherAnimaux()
|
|
|
|
|
{
|
|
|
|
|
HashSet<Animal> listeAnimaux = new HashSet<Animal>();
|
|
|
|
|
listeAnimaux.Add(new("pouet"));
|
|
|
|
|
listeAnimaux.Add(new("stella"));
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
foreach (Animal listeAnimau in listeAnimaux)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(listeAnimau.Nom);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private static void ajouterAnimaux()
|
|
|
|
|
{
|
|
|
|
|
HashSet<Animal> listeAnimaux = new HashSet<Animal>();
|
|
|
|
|
afficherEspece();
|
|
|
|
|
Console.Write("ecrir le nom de l'animal de votre choix (ou R pour retour) :");
|
|
|
|
|
string nom = Convert.ToString(Console.ReadLine());
|
|
|
|
|
if (nom == "R")
|
|
|
|
|
return;
|
|
|
|
|
Console.WriteLine(nom);
|
|
|
|
|
|
|
|
|
|
Console.Write("ecrir le prenom de l'animal (ou R pour retour) :");
|
|
|
|
|
string nomAnimal = Convert.ToString(Console.ReadLine());
|
|
|
|
|
|
|
|
|
|
listeAnimaux.Add(new(nomAnimal));
|
|
|
|
|
afficherAnimaux();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void afficherEspece()
|
|
|
|
|
{
|
|
|
|
|
HashSet<Espece> listeEspece = new HashSet<Espece>();
|
|
|
|
|
listeEspece.Add(new("chien"));
|
|
|
|
|
listeEspece.Add(new("chat"));
|
|
|
|
|
listeEspece.Add(new("furet"));
|
|
|
|
|
listeEspece.Add(new("poisson"));
|
|
|
|
|
listeEspece.Add(new("hamster"));
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
foreach (Espece lEspece in listeEspece)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(lEspece.Nom);
|
|
|
|
|
}
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
Console.Write("ecrir le nom de l'espece pour plus d'info (ou R pour retour) :");
|
|
|
|
|
string nom = Convert.ToString(Console.ReadLine());
|
|
|
|
|
if (nom == "R")
|
|
|
|
|
return;
|
|
|
|
|
Console.WriteLine(nom);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void testdebase()
|
|
|
|
|
{
|
|
|
|
|
HashSet<Espece> animaux = new HashSet<Espece>();
|
|
|
|
@ -89,7 +156,7 @@ class Program
|
|
|
|
|
animaux.Add(new("Chat", "Les chats sont les meilleurs animaux pour faire de la ronron thérapie."));
|
|
|
|
|
animaux.Add(new("Hamster", "Les hamster meurent facilement."));
|
|
|
|
|
|
|
|
|
|
Race boxer = new("Boxer");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//chien.afficherInfoUtile();
|
|
|
|
|
}
|
|
|
|
|