static void Main(string[] args) { int happyPoints = 0; string[] tokens = Console.ReadLine().Split(); foreach (var food in tokens) { Food currFood = Factory.GetInputFood(food); happyPoints += currFood.FoodValue; } Console.WriteLine(happyPoints); Console.WriteLine(MoodFactory.GetGandalfMood(happyPoints)); }
public static void Main(string[] args) { var foodTokens = Console.ReadLine() .Split(new char[] { '\t', ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries); var foods = new List <Food>(); var moodFactor = 0; foreach (var item in foodTokens) { foods.Add(FoodFactory.MakeFood(item)); } foreach (var food in foods) { moodFactor += food.GetHappinessPoints(); } Console.WriteLine(moodFactor); Console.WriteLine(MoodFactory.GetCorrespondingMood(moodFactor)); }
public Mood GetMentalCondition() { return(MoodFactory.GetMood(this.HappinessPoints)); }
public Engine() { this.foodFactory = new FoodFactory(); this.moodFactory = new MoodFactory(); }