Ejemplo n.º 1
0
    public static void Main()
    {
        string[] inputFoods = Console.ReadLine().Split();

        int happinessPoints = 0;

        foreach (string foodStr in inputFoods)
        {
            Food.Foods food = Food.Foods.OtherFood;

            try
            {
                food = Enum.Parse <Food.Foods>(foodStr, true);
            }
            catch (ArgumentException)
            { }

            Food foodObj = FoodFactory.GetFood(food);

            happinessPoints += foodObj.HappinessPoints;
        }

        Mood mood = MoodFactory.GetMood(happinessPoints);

        Console.WriteLine(happinessPoints);
        Console.WriteLine(mood);
    }
    public static void Main()
    {
        // Split by whitespace
        string[] foodNames = Console.ReadLine().Split(new char[0], StringSplitOptions.RemoveEmptyEntries);

        List <Food> foods = new List <Food>();

        foreach (string foodName in foodNames)
        {
            char[] currentFoodName = foodName.ToLower().ToCharArray();
            currentFoodName[0] = char.ToUpper(currentFoodName[0]);

            foods.Add(FoodFactory.CreateFood(new string(currentFoodName)));
        }

        int happinessLevel = 0;

        foreach (Food food in foods)
        {
            happinessLevel += food.Happiness;
        }

        Console.WriteLine(happinessLevel);
        Console.WriteLine(MoodFactory.CreateMood(happinessLevel));
    }
Ejemplo n.º 3
0
        public static void Main()
        {
            var inputLine = Console.ReadLine();

            var mood = MoodFactory.CreateMood(inputLine);

            Console.WriteLine(mood.ToString());
        }
Ejemplo n.º 4
0
    static void Main()
    {
        FoodFactory foodFactory = new FoodFactory();
        MoodFactory moodFactory = new MoodFactory(foodFactory.Health);

        Console.WriteLine(foodFactory);
        Console.WriteLine(moodFactory);
    }
Ejemplo n.º 5
0
    public static void Main()
    {
        var food           = Console.ReadLine().Split().ToList();
        var totalHappiness = GetAllFood(food);
        var mood           = MoodFactory.GetMood(totalHappiness);

        Console.WriteLine(totalHappiness);
        Console.WriteLine(mood.ToString());
    }
Ejemplo n.º 6
0
    static void Main()
    {
        var input = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        int    hapiness = new FoodFactory().CalculateHappiness(input);
        string mood     = new MoodFactory().GenerateMood(hapiness);

        Console.WriteLine(hapiness);
        Console.WriteLine(mood);
    }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            var products = Console.ReadLine().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            var foods    = new List <Food>();

            AddFoodsInput(products, foods);
            var happinessPoints = foods.Sum(a => a.Happiness);
            var mood            = MoodFactory.GetMood(happinessPoints);

            PrintResult(happinessPoints, mood);
        }
Ejemplo n.º 8
0
    public static void Main()
    {
        string input = Console.ReadLine();

        var gandalf = new Gandalf();

        var foods = FoodFactory.ProduceFood(input);

        MoodFactory.ChangeMood(gandalf, foods);

        Console.WriteLine(gandalf);
    }
Ejemplo n.º 9
0
    public static void Main()
    {
        var foodFactory = new FoodFactory();
        var createFood  = foodFactory.ReadFood();
        var moodFactory = new MoodFactory();

        var happinessPoints = moodFactory.CalculateHappinessPoints(createFood);
        var currentMood     = moodFactory.CalculateMood(happinessPoints);

        Console.WriteLine($"{happinessPoints + Environment.NewLine}" +
                          $"{currentMood}");
    }
Ejemplo n.º 10
0
    public static void Main(string[] args)
    {
        var collection       = Console.ReadLine().Split();
        var pointsOfHapyness = 0;

        foreach (var item in collection)
        {
            pointsOfHapyness += FoodFactory.GetFood(item.ToLower());
        }

        Console.WriteLine(pointsOfHapyness);
        Console.WriteLine(MoodFactory.GetMode(pointsOfHapyness));
    }
Ejemplo n.º 11
0
        static void Main()
        {
            FoodFactory foodFactory = new FoodFactory();
            MoodFactory moodFactory = new MoodFactory();

            Console.ReadLine().Split(new [] { " " }, StringSplitOptions.RemoveEmptyEntries)
            .ToList()
            .ForEach(x => foods.Add(foodFactory.CreateInstace(x.ToLower())));
            int  totalPoints = foods.Select(x => x.Points).Sum();
            Mood mood        = moodFactory.CreateInstance(totalPoints);

            Console.WriteLine(mood.ToString());
        }
Ejemplo n.º 12
0
    static void Main(string[] args)
    {
        string[] foodLine          = Console.ReadLine().Split();
        int      gandalfsHappiness = 0;

        for (int food = 0; food < foodLine.Length; food++)
        {
            gandalfsHappiness = FindFoodAndGetPoints(foodLine, gandalfsHappiness, food);
        }

        MoodFactory moodFactory = new MoodFactory();
        string      moodsName   = moodFactory.Mood(gandalfsHappiness);

        Console.WriteLine(gandalfsHappiness);
        Console.WriteLine(moodsName);
    }
Ejemplo n.º 13
0
        private static void Task5()
        {
            var foodData = Console.ReadLine().Split(new string[] { ", ", " " }, StringSplitOptions.RemoveEmptyEntries);

            var happinesPoints = 0;

            foreach (var foodName in foodData)
            {
                var food = FoodFactory.Get(foodName);
                happinesPoints += food.Points;
            }

            var mood = MoodFactory.Get(happinesPoints);

            Console.WriteLine(happinesPoints + Environment.NewLine + mood.Name);
        }
Ejemplo n.º 14
0
    public static void Main()
    {
        List <Food> foods = new List <Food>();

        string[] inputParts = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        foreach (string foodName in inputParts)
        {
            Food food = FoodFactory.GetFood(foodName);
            foods.Add(food);
        }

        Mood mood = MoodFactory.GetMood(foods);

        Console.WriteLine(foods.Sum(f => f.PointsOfHappiness));
        Console.WriteLine(mood);
    }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            var inputFoods      = Console.ReadLine().Split();
            var happinessPoints = 0;

            foreach (var food in inputFoods)
            {
                var foodFactory = new FoodFactory(food);
                happinessPoints += foodFactory.GetFoodPoints();
            }

            var moodFactory = new MoodFactory(happinessPoints);

            Console.WriteLine(happinessPoints);
            Console.WriteLine(moodFactory.GetMood());
        }
Ejemplo n.º 16
0
    static void Main(string[] args)
    {
        Gandalf gandalf     = new Gandalf();
        var     foodFactory = new FoodFactory();
        var     input       = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();

        foreach (var f in input)
        {
            var food = foodFactory.CreateFood(f);
            gandalf.Eat(food);
        }

        MoodFactory mood = new MoodFactory();

        Console.WriteLine(gandalf.TotalPoints);
        Console.WriteLine(mood.CreateMood(gandalf.TotalPoints).Name);
    }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            string[] input  = Console.ReadLine().Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            var      list   = new List <Food>();
            var      points = 0;

            for (int i = 0; i < input.Length; i++)
            {
                list.Add(FoodFactory.ProduceFood(input[i]));
            }
            foreach (var item in list)
            {
                points += item.GetHappiness();
            }
            Console.WriteLine(points);
            Console.WriteLine(MoodFactory.calcMood(points));
        }
Ejemplo n.º 18
0
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

        var sumHapinesPoints = 0;

        foreach (var item in input)
        {
            var foodFactory = new FoodFactory(item);
            sumHapinesPoints += foodFactory.GetFoodPoints(item);
        }

        var moodFactory = new MoodFactory(sumHapinesPoints);

        Console.WriteLine(sumHapinesPoints);
        moodFactory.GetMood(sumHapinesPoints);
    }
Ejemplo n.º 19
0
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(" ").ToArray();

        List <Food> allTheFood = new List <Food>();

        foreach (var food in input)
        {
            allTheFood.Add(FoodFactory.ProduceFoodObject(food));
        }
        GandalfEaterOfWorlds gandy = new GandalfEaterOfWorlds();

        gandy.GandalfEats(allTheFood);

        Console.WriteLine(gandy.Happiness);
        Console.WriteLine(MoodFactory.GetMood(gandy.Happiness));
    }
Ejemplo n.º 20
0
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(new char[] { ' ', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

        int tottalPointsOfHappiness = 0;

        foreach (var item in input)
        {
            FoodFactory foodFactory = new FoodFactory();
            Food        currentFood = foodFactory.GetFood(item);
            tottalPointsOfHappiness += currentFood.PointsOfHappines;
        }

        MoodFactory moodFactory = new MoodFactory();

        Console.WriteLine(tottalPointsOfHappiness);
        Console.WriteLine(moodFactory.GetMood(tottalPointsOfHappiness));
    }
Ejemplo n.º 21
0
    static void Main()
    {
        Wizard         Gandalf     = new Wizard("Gandalf the Gray");
        Queue <string> foods       = new Queue <string>(Console.ReadLine().Split());
        FoodFactory    foodFactory = new FoodFactory();

        while (foods.Count > 0)
        {
            string foodType = foods.Dequeue();
            Food   food     = (Food)foodFactory.Produce(foodType);
            Gandalf.Eat(food);
        }
        Console.WriteLine(Gandalf.MoodPoints);
        MoodFactory moodFactory = new MoodFactory();
        Mood        mood        = (Mood)moodFactory.Produce(Gandalf.MoodPoints);

        Console.WriteLine(mood.Type);
    }
Ejemplo n.º 22
0
        public void Run()
        {
            foods = new List <Food>();

            string[] data = Console.ReadLine().ToLower().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string name in data)
            {
                Food food = FoodFactory.CreateFood(name);
                foods.Add(food);
            }

            int happiness = CalculateHappiness();

            mood = MoodFactory.CreateMood(happiness);

            Print();
        }
Ejemplo n.º 23
0
    public static void Main()
    {
        // Пак сам - да вникна в тази задача!

        string[]    foodArgs = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        List <Food> foods    = new List <Food>();

        foreach (string food in foodArgs)
        {
            Food currentFood = FoodFactory.GenerateFood(food);
            foods.Add(currentFood);
        }

        Mood mood = MoodFactory.GenerateMood(foods);

        Console.WriteLine(foods.Sum(f => f.PointsOfHappines));
        Console.WriteLine(mood);
    }
Ejemplo n.º 24
0
    public static void Main()
    {
        List <Food> foodList = new List <Food>();

        string[] line = Console.ReadLine().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToArray();
        foreach (var food in line)
        {
            Food currFood = FoodFactory.GetFood(food.ToLower());
            foodList.Add(currFood);
        }

        Mood mood = MoodFactory.GetMood(foodList);

        int allPoints = foodList.Sum(x => x.HappinessPoints);

        Console.WriteLine(allPoints);
        Console.WriteLine(mood);
    }
Ejemplo n.º 25
0
    public static void Main()
    {
        string[] foodsNames = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();

        List <Food> foods = new List <Food>();

        for (int i = 0; i < foodsNames.Length; i++)
        {
            Food food = FoodFactory.CreateFood(foodsNames[i].ToLower());
            foods.Add(food);
        }

        Mood mood = MoodFactory.CreateMood(foods);

        Gandalf gandalf = new Gandalf(foods, mood);

        Console.WriteLine(gandalf);
    }
Ejemplo n.º 26
0
    private static void Main()
    {
        List <string> foodsInput = Console.ReadLine()
                                   .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                                   .ToList();
        List <Food> foods = new List <Food>();

        foreach (var food in foodsInput)
        {
            Food current = FoodFactory.GetFood(food);
            foods.Add(current);
        }

        int  gandalfPoints = MoodFactory.Happiness(foods);
        Mood mood          = MoodFactory.GetMood(gandalfPoints);

        Console.WriteLine(gandalfPoints);
        Console.WriteLine(mood);
    }
Ejemplo n.º 27
0
        static void Main()
        {
            string input = System.Console.ReadLine();

            string[] args = input.Split();

            int happinesPoints = 0;

            foreach (var item in args)
            {
                var food = FoodFactory.GetFood(item);
                happinesPoints += food.HappinessPoints;
            }

            var mood = MoodFactory.GetMood(happinesPoints);

            System.Console.WriteLine(happinesPoints);
            System.Console.WriteLine(mood.MoodStatus);
        }
Ejemplo n.º 28
0
    public static void Main()
    {
        var gandalf     = new Gandalf();
        var foodFactory = new FoodFactory();

        Console.ReadLine()
        .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
        .ToList()
        .ForEach(f =>
        {
            var food = foodFactory.CreateFood(f);
            gandalf.Eat(food);
        });

        Console.WriteLine(gandalf.TotalPointsOfHappiness);

        MoodFactory moodFactory = new MoodFactory();

        Console.WriteLine(moodFactory.CreateMood(gandalf.TotalPointsOfHappiness).Name);
    }
Ejemplo n.º 29
0
        public static void Main()
        {
            var foodFactory = new FoodFactory();
            var moodFactory = new MoodFactory();

            var inputFoods = Console.ReadLine()
                             .Split(new char[] { ' ', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            var gandi = new Gandalf();

            foreach (var foodstring in inputFoods)
            {
                var food = foodFactory.GetFood(foodstring);
                gandi.Eat(food);
            }
            var totalhappines = gandi.GetHappinessPoints();
            var mood          = moodFactory.GetMood(totalhappines);

            Console.WriteLine(totalhappines);
            Console.WriteLine(mood);
        }
        static void Main()
        {
            var foodNames = Console.ReadLine().Split();

            var foods = new List <Food>();

            foreach (var foodName in foodNames)
            {
                Food food = FoodFactory.CreateFood(foodName);

                foods.Add(food);
            }

            var happinessPoints = foods.Sum(f => f.HappinessPoints);

            Mood mood = MoodFactory.GetMood(foods);

            Console.WriteLine(happinessPoints);
            Console.WriteLine(mood);
        }