static void Main(string[] args) { var eatenFoods = Console.ReadLine().Split(); var gandalf = new Gandalf(); foreach (var food in eatenFoods) { gandalf.EatFood(FoodFactory.GetFood(food)); } Console.WriteLine(gandalf); }
static void Main() { string[] foods = Console.ReadLine().Split(); Gandalf gandalf = new Gandalf(); foreach (string food in foods) { gandalf.EatFood(food); } Console.WriteLine(gandalf); }
private static Gandalf FeedGandalf() { var foods = Console.ReadLine().ToLower().Split(); var gandalf = new Gandalf(); foreach (var x in foods) { gandalf.EatFood(x); } return(gandalf); }
static void Main(string[] args) { var foods = Console.ReadLine().ToLower().Split(' ', StringSplitOptions.RemoveEmptyEntries); var gandalf = new Gandalf(); foreach (var food in foods) { gandalf.EatFood(food); } Console.WriteLine(gandalf.HappinessPoints); Console.WriteLine(gandalf.GetMood()); }
static void Main(string[] args) { Gandalf gandalf = new Gandalf(); var input = Console.ReadLine() .Split(' ') .ToList(); for (int i = 0; i < input.Count; i++) { gandalf.EatFood(input[i]); } Console.Write(gandalf); }
public static void Main() { string[] input = Console.ReadLine().ToLower().Split(); Gandalf gandalf = new Gandalf(); foreach (var food in input) { gandalf.EatFood(food); } Console.WriteLine(gandalf.Happiness); Console.WriteLine(gandalf.CalculateMood()); }
public static void Main() { var foods = Console.ReadLine() .ToLower() .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); var gandalf = new Gandalf(); foreach (var food in foods) { gandalf.EatFood(food); } Console.WriteLine(gandalf.HappinessPoints); Console.WriteLine(gandalf.CalculateMood()); }