NedyalkoKikov

MethodsWithCases

May 5th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace MethodWithCases
  8. {
  9. class MethodsWithCases
  10. {
  11. static void Main()
  12. {
  13. string text = Console.ReadLine().ToLower();
  14. PrintAnimalSpicies(text);
  15. }
  16. public static void PrintAnimalSpicies(string text)
  17. {
  18. switch(text)
  19. {
  20. case "dog":
  21. {
  22. Console.WriteLine("mammal");
  23. break;
  24. }
  25. case "cat":
  26. {
  27. Console.WriteLine("mammal");
  28. break;
  29. }
  30. case "snake":
  31. {
  32. Console.WriteLine("reptile");
  33. break;
  34. }
  35. case "iguana":
  36. {
  37. Console.WriteLine("reptile");
  38. break;
  39. }
  40. case "hameleon":
  41. {
  42. Console.WriteLine("reptile");
  43. break;
  44. }
  45. default:
  46. {
  47. Console.WriteLine("unknown");
  48. break;
  49. }
  50. }
  51. }
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment