Boris-Stavrev92

Untitled

Jun 2nd, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 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 ConsoleApplication2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. Program2.task4();
  14.  
  15.  
  16. }
  17. }
  18.  
  19. class Program2
  20. {
  21. public static void task4()
  22. {
  23.  
  24. var a = Console.ReadLine();
  25. var b = "";
  26. double val = double.Parse(Console.ReadLine());
  27.  
  28. double constant;
  29. switch (a)
  30. {
  31. case "miles":
  32. constant = 1.6;
  33. b = "kilometers";
  34. break;
  35.  
  36. case "inches":
  37. constant = 2.54;
  38. b = "centimeters";
  39. break;
  40.  
  41. case "feet":
  42. constant = 30;
  43. b = "centimeters";
  44. break;
  45.  
  46. case "yards":
  47. constant = 0.91;
  48. b = "meters";
  49. break;
  50.  
  51. case "gallons":
  52. constant = 3.8;
  53. b = "liters";
  54. break;
  55.  
  56. default:
  57. constant = 1;
  58. b = "";
  59. break;
  60.  
  61.  
  62. }
  63.  
  64. Console.Write(val);
  65. Console.Write(" ");
  66. Console.Write(a);
  67. Console.Write(" = ");
  68. Console.Write(val * constant);
  69. Console.Write(" ");
  70. Console.WriteLine(b);
  71.  
  72.  
  73. }
  74. }
  75.  
  76.  
  77. }
Advertisement
Add Comment
Please, Sign In to add comment