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