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"); }
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)); }
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); }
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"); }