benjamin, ajout liste animaux, liste espece, ajout animaux
continuous-integration/drone/push Build is failing Details

Benjamin BACHELARD 2 years ago
parent 36396ca4df
commit 5fb07c1b3f

@ -8,7 +8,6 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Modelbis\Model.csproj" />
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>

@ -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,8 +156,8 @@ 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();
}

@ -15,15 +15,7 @@ namespace Model
}
public void AfficherlisteRace()
{
/*
for (int i = 0; i < nb_animal; i++) {
Console.WriteLine(Nom);
}
*/
}
public void afficherInfoUtile()
public void afficherInfo()
{
Console.WriteLine(Info);
}

@ -9,8 +9,8 @@ namespace Model
public class Espece
{
public string Nom { get; set; }
public string Info { get; set; }
public string Conseil { get; set; }
public string Info;
public string Conseil;
public HashSet<Race> Races { get; set; } = new HashSet<Race>();
public Espece(string nom, string info = "Aucune information", string conseil = "Aucun conseil")
@ -19,5 +19,18 @@ namespace Model
Info = info;
Conseil = conseil;
}
/*
public static void ListeInfo()
{
Console.WriteLine(Nom);
Console.WriteLine(Info);
Console.WriteLine(Conseil);
Console.WriteLine();
foreach (Race lRaces in Races)
{
Console.WriteLine(lRaces.Nom);
}
}*/
}
}

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -12,13 +13,13 @@ namespace Model
{
public bool theme_color = true;
HashSet<Animal> listeAnimaux = new HashSet<Animal>();
//HashSet<Espece> listeAnimaux = new HashSet<Espece>();
public System() { }
HashSet<Espece> listeEspece = new HashSet<Espece>();
public void ChangeColor()
{
if (theme_color == true)
theme_color = false;
else theme_color = true;
theme_color = !theme_color;
}
public void RechercheAnimal(string nom)
{
@ -28,6 +29,13 @@ namespace Model
return;
}
}
public void AfficherListeAnimaux() {
foreach (Animal aAnimal in listeAnimaux)
{
Console.WriteLine(aAnimal);
}
}
public void Retour()
{

Loading…
Cancel
Save