Advertisement
sharli

Currency_Converter

Apr 22nd, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 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 Currency_Converter
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. decimal input = decimal.Parse(Console.ReadLine());
  14. string currency1 = Console.ReadLine();
  15. string currency2 = Console.ReadLine();
  16. decimal convertionOne = new decimal();
  17. decimal convertionTwo = new decimal();
  18. decimal BGN = 1;
  19. decimal USD = 1.79549m;
  20. decimal EUR = 1.95583m;
  21. decimal GBP = 2.53405m;
  22. switch(currency1)
  23. {
  24. case "BGN":
  25. convertionOne = input * BGN;
  26. break;
  27. case "USD":
  28. convertionOne = input * USD;
  29. break;
  30. case "EUR":
  31. convertionOne = input * EUR;
  32. break;
  33. case "GBP":
  34. convertionOne = input * GBP;
  35. break;
  36. }
  37. switch (currency2)
  38. {
  39. case "BGN":
  40. convertionTwo = convertionOne / BGN;
  41. break;
  42. case "USD":
  43. convertionTwo = convertionOne / USD;
  44. break;
  45. case "EUR":
  46. convertionTwo = convertionOne / EUR;
  47. break;
  48. case "GBP":
  49. convertionTwo = convertionOne / GBP;
  50. break;
  51. }
  52. Console.WriteLine(Math.Round(convertionTwo, 2));
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement