예제 #1
0
        static void Main(string[] args)
        {
            List <GandalfFoodEaten> gandalfFoodEatens = new List <GandalfFoodEaten>();
            var inputGandalsFood = Console.ReadLine()
                                   .Split(new[] { ' ' });

            foreach (var currentFood in inputGandalsFood)
            {
                GandalfFoodEaten gandalfFood = new GandalfFoodEaten(currentFood);
                gandalfFoodEatens.Add(gandalfFood);
            }
            int result = 0;

            foreach (var currentFood in gandalfFoodEatens)
            {
                result += currentFood.GetCurrentFood.happines;
            }
            Console.WriteLine(result);
            MoodFactory moodFactory = new MoodFactory();

            moodFactory.ChechMood(result);
            Mood moodResult = moodFactory.GetMood();

            Console.WriteLine(moodResult);
        }
예제 #2
0
        public static void Main(string[] args)
        {
            string[] arr = Console.ReadLine().Split();

            FoodFactory foodFactory = new FoodFactory();
            MoodFactory moodFactory = new MoodFactory();

            int  happines = foodFactory.GetHappines(arr);
            Mood mood     = moodFactory.GetMood(happines);

            Console.WriteLine($"{mood.Happines}");
            Console.WriteLine($"{mood.Type}");
        }
예제 #3
0
        public static void Main()
        {
            string[] gandalfFood = Console
                                   .ReadLine()
                                   .Split(" ", StringSplitOptions.RemoveEmptyEntries);

            var foodFactory         = new FoodFactory(gandalfFood);
            int foodHappinessPoints = foodFactory.GetFoodHappiness();

            var    moodFactory = new MoodFactory(foodHappinessPoints);
            string gandalfMood = moodFactory.GetMood();

            Console.WriteLine(foodHappinessPoints);
            Console.WriteLine(gandalfMood);
        }
예제 #4
0
        static void Main(string[] args)
        {
            List <Food> foodsEaten  = new List <Food>();
            FoodFactory foodFactory = new FoodFactory();
            MoodFactory moodFactory = new MoodFactory();

            string[] foods = Console.ReadLine().Split();

            foreach (var food in foods)
            {
                Food foodToAdd = foodFactory.GetFood(food);

                foodsEaten.Add(foodToAdd);
            }

            int happinesFood = foodsEaten
                               .Select(x => x == null ? -1 : x.Happiness)
                               .Sum();

            Mood happinesMood = moodFactory.GetMood(happinesFood);

            Console.WriteLine(happinesFood);
            Console.WriteLine(happinesMood.GetType().Name);
        }
예제 #5
0
 public Mood GetMood()
 {
     return(MoodFactory.GetMood(this.pointsOfHappiness));
 }
예제 #6
0
 public Mood GetMentalCondition()
 {
     return(MoodFactory.GetMood(this.HappinessPoints));
 }