예제 #1
0
        public static void Main(string[] args)
        {
            var listOfFood = new List <Food>();
            var inputLine  = Console.ReadLine()
                             .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var food in inputLine)
            {
                var createFood = FoodFactory.CreateFood(food);
                listOfFood.Add(createFood);
            }

            Console.WriteLine(MoodFactory.CalculatePointsOfHappiness(listOfFood));
            MoodFactory.PrintMood(listOfFood);
        }
예제 #2
0
        public static void PrintMood(List <Food> foods)
        {
            var sumHappines = MoodFactory.CalculatePointsOfHappiness(foods);

            if (sumHappines < -5)
            {
                Console.WriteLine("Angry");
            }
            else if (sumHappines >= -5 && sumHappines <= 0)
            {
                Console.WriteLine("Sad");
            }
            else if (sumHappines >= 1 && sumHappines <= 15)
            {
                Console.WriteLine("Happy");
            }
            else if (sumHappines > 15)
            {
                Console.WriteLine("JavaScript");
            }
        }