Exemplo n.º 1
0
        static void Main()
        {
            var inputLine = Console.ReadLine()
                            .Split(new[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            var mood = 0;

            foreach (var food in inputLine)
            {
                mood += FoodFactory.MakeFood(food).GetPoints();
            }

            Console.WriteLine(mood);
            Console.WriteLine(MoodFactory.GetMood(mood).GetMood());
        }
Exemplo n.º 2
0
        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);
        }