Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _09_FoodFactory
- {
- class FoodFactory
- {
- static void Main(string[] args)
- {
- List<string> input = Console.ReadLine().Split(' ').ToList();
- Console.WriteLine(Mood.CalculateMood(Food.CalculatePoints(input)));
- }
- }
- public static class Food
- {
- public static int CalculatePoints(List<string> food)
- {
- int sum = 0;
- foreach (string word in food)
- {
- switch (word.ToLower())
- {
- case "cram":
- sum += 2;
- break;
- case "lembas":
- sum += 3;
- break;
- case "apple":
- case "melon":
- sum++;
- break;
- case "honeycake":
- sum += 5;
- break;
- case "mushrooms":
- sum -= 10;
- break;
- default:
- sum--;
- break;
- }
- }
- return sum;
- }
- }
- static class Mood
- {
- public static string CalculateMood(int points)
- {
- string mood = string.Empty;
- if (points < -5)
- {
- mood = "Angry";
- }
- else if (points <= 0)
- {
- mood = "Sad";
- }
- else if (points <= 15)
- {
- mood = "Happy";
- }
- else
- {
- mood = "JavaScript";
- }
- return mood;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment