Advertisement
Guest User

Tрета

a guest
Dec 17th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.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 Exam
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string inputCurrency = Console.ReadLine();
  14. double enteredMoney = Double.Parse(Console.ReadLine());
  15. double xrp = 0.22;
  16. double btc = 6400;
  17. double eth = 250;
  18. bool purchased = true;
  19. if (inputCurrency != "ETH" && inputCurrency != "XRP" && inputCurrency != "BTC")
  20. {
  21. Console.WriteLine($"EUR to {inputCurrency} is not supported!");
  22. return;
  23. }
  24. if (enteredMoney > 1000)
  25. {
  26. enteredMoney *= 1.1;
  27. }
  28. double purchasedValue = 0;
  29. if (inputCurrency == "BTC")
  30. {
  31. purchasedValue = enteredMoney / btc;
  32. if (purchasedValue < 0.001)
  33. {
  34. Console.WriteLine("Insufficient funds");
  35. purchased = false;
  36. }
  37. if (purchasedValue > 10)
  38. {
  39. purchasedValue *= 1.02;
  40. }
  41. }
  42. if (inputCurrency == "ETH")
  43. {
  44. purchasedValue = enteredMoney / eth;
  45. if (purchasedValue < 0.0099)
  46. {
  47. Console.WriteLine("Insufficient funds");
  48. purchased = false;
  49. }
  50. }
  51. if (inputCurrency == "XRP")
  52. {
  53. purchasedValue = enteredMoney / xrp;
  54. if (purchasedValue < 80)
  55. {
  56. Console.WriteLine("Insufficient funds");
  57. purchased = false;
  58. }
  59. if (purchasedValue > 1000 && purchasedValue < 2500)
  60. {
  61. purchasedValue *= 1.05;
  62. }
  63. if (purchasedValue >= 2500)
  64. {
  65. purchasedValue *= 1.1;
  66. }
  67. }
  68. if (purchased)
  69. {
  70. Console.WriteLine($"Successfully purchased {purchasedValue:f3} {inputCurrency}");
  71. }
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement