예제 #1
0
        public string Adopt(string animalName, string owner)
        {
            var currentAnimal = hotel.GetAnimal(animalName);

            hotel.Adopt(animalName, owner);

            if (currentAnimal.IsChipped)
            {
                return($"{owner} adopted animal with chip");
            }

            return($"{owner} adopted animal without chip");
        }
예제 #2
0
        public string Adopt(string animalName, string owner)
        {
            ThrowEx(animalName);
            hotel.Adopt(animalName, owner);

            if (animals[animalName].IsChipped)
            {
                return($"{owner} adopted animal with chip");
            }
            else
            {
                return($"{owner} adopted animal without chip");
            }
        }
예제 #3
0
        public string Adopt(string animalName, string owner)
        {
            IAnimal animal = CheckForAnimal(animalName);

            hotel.Adopt(animalName, owner);
            string result;

            if (animal.IsChipped)
            {
                result = $"{owner} adopted animal with chip";
            }
            else
            {
                result = $"{owner} adopted animal without chip";
            }
            AddAdoptedAnimalToDictionary(owner, animal.Name);

            return(result);
        }