mattnguyen

Untitled

Mar 27th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.IO;
  6. using System.Threading.Tasks;
  7.  
  8. namespace currencyConverter
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14.  
  15.  
  16. Console.WriteLine("Hello, Temenuzhka!");
  17.  
  18.  
  19. int amount = 1;
  20. string from;
  21.  
  22. double usdToBgn = 1.66;
  23. double eurToBgn = 1.96;
  24. double gbpToBgn = 2.28;
  25.  
  26. double usdToEur = 0.85;
  27. double bgnToEur = 0.51;
  28. double gbpToeur = 1.17;
  29.  
  30. double eurToUsd = 1.18;
  31. double bgnToUsd = 0.60;
  32. double gbpToUsd = 1.38;
  33.  
  34. double bgnToGbp = 0.44;
  35. double usdToGbp = 0.73;
  36. double eurToGbp = 0.86;
  37.  
  38.  
  39.  
  40.  
  41.  
  42. while (amount != 0)
  43. //&& string from=="USD" || from=="BGN"|| from=="GBP"|| from=="EUR")
  44. {
  45.  
  46. Console.WriteLine("Enter amount:");
  47. amount = int.Parse(Console.ReadLine());
  48. if (amount == 0)
  49. {
  50. Console.WriteLine("Invalid amount!");
  51.  
  52. break;
  53. }
  54. else
  55. {
  56.  
  57. Console.WriteLine("From what currency: ");
  58. from = Console.ReadLine();
  59.  
  60.  
  61. switch (from)
  62. {
  63.  
  64.  
  65.  
  66. case "EUR":
  67. //(from == "EUR".ToLower())
  68. {
  69.  
  70. Console.WriteLine("USD:" + (eurToUsd * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  71.  
  72. Console.WriteLine("BGN:" + (eurToBgn * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  73.  
  74. Console.WriteLine("GBP:" + (eurToGbp * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  75. break;
  76. }
  77. case "USD":
  78.  
  79. //(from == "USD".ToLower())
  80. {
  81.  
  82. Console.WriteLine("EUR:" + (usdToEur * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  83.  
  84. Console.WriteLine("BGN:" + (usdToBgn * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  85.  
  86. Console.WriteLine("GBP:" + (usdToGbp * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  87. break;
  88. }
  89. case "BGN":
  90.  
  91. //while (from == "BGN".ToLower())
  92. {
  93.  
  94. Console.WriteLine("EUR:" + (bgnToEur * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  95.  
  96. Console.WriteLine("USD:" + (bgnToUsd * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  97.  
  98. Console.WriteLine("GBP:" + (bgnToGbp * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  99. break;
  100. }
  101. case "GBP":
  102. //while (from == "GBP".ToLower())
  103. {
  104.  
  105. Console.WriteLine("EUR:" + (gbpToeur * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  106.  
  107. Console.WriteLine("BGN:" + (gbpToBgn * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  108.  
  109. Console.WriteLine("USD:" + (gbpToUsd * amount) + DateTime.Now.ToString(" dd MMMM yyyy HH:mm:ss"));
  110. break;
  111. }
  112.  
  113.  
  114. default:
  115.  
  116. Console.WriteLine("Unknown conversion");
  117. Console.WriteLine("Please enter valid currency: ");
  118. from = Console.ReadLine();
  119.  
  120. break;
  121.  
  122. }
  123.  
  124.  
  125.  
  126. }
  127.  
  128.  
  129.  
  130. }
  131. }
  132. }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment