o_ignatov

more_exercises_04

Jun 2nd, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 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 _04_Tourist_info
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string initImperialUnit = Console.ReadLine();
  14. decimal initValue = decimal.Parse(Console.ReadLine());
  15.  
  16. switch (initImperialUnit)
  17. {
  18. case "miles":
  19. Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 1.6m:F2} kilometers");
  20. break;
  21. case "inches":
  22. Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 2.54m:F2} centimeters");
  23. break;
  24. case "feet":
  25. Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 30m:F2} centimeters");
  26. break;
  27. case "yards":
  28. Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 0.91m:F2} meters");
  29. break;
  30. case "gallons":
  31. Console.WriteLine($"{initValue} {initImperialUnit} = {initValue * 3.8m:F2} iters");
  32. break;
  33. default:
  34. break;
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment