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); }
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}"); }
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); }
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); }
public Mood GetMood() { return(MoodFactory.GetMood(this.pointsOfHappiness)); }
public Mood GetMentalCondition() { return(MoodFactory.GetMood(this.HappinessPoints)); }