Beispiel #1
0
        public string RegisterAnimal(string type, string name, int energy, int happiness, int procedureTime)
        {
            IAnimal animal = animalFactory.CreateAnimal(type, name, energy, happiness, procedureTime);

            hotel.Accommodate(animal);
            return($"Animal {animal.Name} registered successfully");
        }
        public string RegisterAnimal(string type, string name, int energy, int happiness, int playTime)
        {
            var newAnimal = animalFactory.CreateAnimal(type, name, energy, happiness, playTime);

            hotel.Accommodate(newAnimal);
            return($"Animal {name} registered successfully");
        }
Beispiel #3
0
        public string RegisterAnimal(string type, string name, int energy, int happiness, int procedureTime)
        {
            IAnimal animal = animalFactory.CreateAnimal(type, name, energy, happiness, procedureTime);

            hotel.Accommodate(animal);

            return(String.Format(Messages.REGISTERED_Animal, name));
        }
Beispiel #4
0
        public string RegisterAnimal(string type, string name, int energy,
                                     int happiness, int procedureTime)
        {
            Animal animal = animalFactory.CreateAnimal(type, name, energy,
                                                       happiness, procedureTime);

            this.hotel.Accommodate(animal);

            string result = $"Animal {name} registered successfully";

            return(result);
        }
Beispiel #5
0
        public string RegisterAnimal(string type, string name, int energy, int happiness, int procedureTime)
        {
            AnimalFactory animalFactory = new AnimalFactory();
            Animal        animal        = animalFactory.CreateAnimal(type, name, energy, happiness, procedureTime);

            if (Hotel.Capacity == hotel.Animals.Count)
            {
                throw new InvalidOperationException("Not enough capacity");
            }
            if (hotel.Animals.ContainsKey(animal.Name))
            {
                throw new ArgumentException($"Animal {animal.Name} already exist");
            }
            hotel.Accommodate(animal);

            return($"Animal {animal.Name} registered successfully");
        }