Beispiel #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);
        }
Beispiel #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}");
        }
Beispiel #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);
        }
Beispiel #4
0
        public static void Main()
        {
            var listOfFood = new List <Food>();

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

            foreach (var food in foodList)
            {
                listOfFood.Add(FoodFactory.Create(food));
            }

            Console.WriteLine(listOfFood.Sum(food => food.FoodPoints));
            Console.WriteLine(MoodFactory.CreateMood(listOfFood).GetType().Name);
        }
        static void Main()
        {
            string input      = Console.ReadLine();
            var    foodTokens = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            int totalHappiness = 0;

            foreach (var food in foodTokens)
            {
                var type = FoodFactory.Get(food);
                totalHappiness += type.Happiness;
            }

            Mood mood = MoodFactory.Get(totalHappiness);

            Console.WriteLine(totalHappiness);
            Console.WriteLine(mood.Type);
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            var foodFactory = new FoodFactory();
            var moodFactory = new MoodFactory();
            var foodList    = new List <Food>();

            var foodNames = Console.ReadLine().Split(' ');

            foreach (var foodName in foodNames)
            {
                string normalizedName = NormalizeName(foodName);
                var    food           = foodFactory.ProduceFood(normalizedName);
                foodList.Add(food);
            }

            int totalHappiness = foodList.Sum(f => f.HappinessPoints);
            var mood           = moodFactory.ProduceMood(totalHappiness);

            Console.WriteLine(totalHappiness);
            Console.WriteLine(mood.Name);

            Console.ReadKey();
        }
        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);
        }
Beispiel #8
0
 public Mood GetMood()
 {
     return(MoodFactory.GetMood(this.pointsOfHappiness));
 }
Beispiel #9
0
 public Mood GetMentalCondition()
 {
     return(MoodFactory.GetMood(this.HappinessPoints));
 }