Exemple #1
0
        public static void Main()
        {
            var foodList = new List <Food>();

            var input = Console.ReadLine().Split();

            foreach (var element in input)
            {
                foodList.Add(FoodFactory.GetFood(element));
            }

            var ttlPoints = foodList.Select(food => food.Happiness).Sum();

            var mood = MoodFactory.GetMood(ttlPoints);

            Console.WriteLine(mood);
        }
        public static void Main()
        {
            var foods = new List <Food>();

            var foodTokens = Regex.Split(Console.ReadLine(), @"\s+");

            foreach (var foodToken in foodTokens)
            {
                var currentFood = FoodFactory.CreateFood(foodToken);
                foods.Add(currentFood);
            }

            Mood mood = MoodFactory.CreateMood(foods);

            Console.WriteLine(foods.Sum(f => f.PointOfHappines));
            Console.WriteLine(mood);
        }
Exemple #3
0
        public static void Main(string[] args)
        {
            var foodFactory = new FoodFactory();
            var moodFactory = new MoodFactory();
            var gandalf     = new Gandalf();

            string[] inputFood = Console.ReadLine()
                                 .Split(new[] { '\t', ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var foodStr in inputFood)
            {
                var food = foodFactory.GetFood(foodStr);
                gandalf.Eat(food);
            }

            var  totalHapinessPoints = gandalf.GetHapinessPoints();
            Mood cureentMood         = moodFactory.GetMood(totalHapinessPoints);

            Console.WriteLine(totalHapinessPoints);
            Console.WriteLine(cureentMood);
        }
        static void Main()
        {
            var lineWithFoods = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            var foodList = new List <Food>();

            foreach (var food in lineWithFoods)
            {
                foodList.Add(FoodFactory.GetFood(food.ToLower()));
            }

            int moodFactor = 0;

            foreach (var typeFood in foodList)
            {
                moodFactor += typeFood.HapinessPoints;
            }

            Console.WriteLine(moodFactor);
            Console.WriteLine(MoodFactory.GetCorrespondingMood(moodFactor).GetType().Name);
        }
Exemple #5
0
        public Mood GetMentalCondition()

        {
            return(MoodFactory.GetMood(this.HappinessPoints));
        }