Esempio n. 1
0
    void Add()
    {
        Console.WriteLine("Please Enter the dogs information in the order that will be presented to you\n");
        HandleInput("Breed: ", out string Breed);
        HandleInput("Name: ", out string Name);
        int Age     = HandleInput("Age: ");
        int Length  = HandleInput("Length: ");
        int Withers = HandleInput("Withers: ");
        int Weight  = HandleInput("Weight: ");

        HandleInput("Gender", out string Gender);

        Dog dog = null;


        if (Breed.ToLower() == "labrador")
        {
            dog = new Labrador(Name.ToLower(), Age, Withers, Length, Gender, Weight, Breed);
        }
        if (Breed.ToLower() == "weiner_dog")
        {
            dog = (new Weiner_Dog(Name, Age, Withers, Length, Gender, Weight, Breed));
        }
        if (Breed.ToLower() == "poodle")
        {
            dog = (new Poodle(Name, Age, Withers, Length, Gender, Weight, Breed));
        }


        int count = 0;

        foreach (Dog d in list)
        {
            if (d.Compare(dog))
            {
                count++;
            }
        }
        if (count == 0)
        {
            list.Add(dog);
        }
        else
        {
            Console.WriteLine("The dog you tried to add already exist");
        }
    }