static void Main(string[] args) { var foodNames = Console.ReadLine().ToLower().Split(' ', StringSplitOptions.RemoveEmptyEntries); List <Food> foods = new List <Food>(); var ff = new FoodFactory(); foreach (var name in foodNames) { foods.Add(ff.CreateFood(name)); } Gandalf gandalf = new Gandalf(foods); Console.WriteLine(gandalf.ToString()); }
public static void Main() { var gandalf = new Gandalf(); var inputFood = Console.ReadLine().Split(new[] { '\t', ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (var foodStr in inputFood) { Food food = FoodFactory.MakeFood(foodStr); gandalf.Eat(food); } int totalHapinessPoints = gandalf.GetHapinessPoints(); Mood currentMood = MoodFactory.GetCorrespondingMood(totalHapinessPoints); Console.WriteLine(totalHapinessPoints); Console.WriteLine(currentMood); }