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)); }
public static void Main() { var inputLine = Console.ReadLine(); var mood = MoodFactory.CreateMood(inputLine); Console.WriteLine(mood.ToString()); }
static void Main() { FoodFactory foodFactory = new FoodFactory(); MoodFactory moodFactory = new MoodFactory(foodFactory.Health); Console.WriteLine(foodFactory); Console.WriteLine(moodFactory); }
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()); }
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); }
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); }
public static void Main() { string input = Console.ReadLine(); var gandalf = new Gandalf(); var foods = FoodFactory.ProduceFood(input); MoodFactory.ChangeMood(gandalf, foods); Console.WriteLine(gandalf); }
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}"); }
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)); }
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()); }
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); }
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); }
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); }
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()); }
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); }
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)); }
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); }
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)); }
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)); }
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); }
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(); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }