NadyaMisheva

commisions

Mar 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. using System;
  2. public class Program
  3. {
  4. public static void Main()
  5. {
  6. double bitcoin = double.Parse(Console.ReadLine());
  7. double eterum = double.Parse(Console.ReadLine());
  8. double litecoin = double.Parse(Console.ReadLine());
  9. int transactions = int.Parse(Console.ReadLine());
  10. double money = 0;
  11. double commision = 0;
  12. double coeff = 0.073456764216789345;
  13. for(int i = 0; i < transactions; i++)
  14. {
  15. int actives = int.Parse(Console.ReadLine());
  16. string valuta = Console.ReadLine();
  17. string typeV = Console.ReadLine();
  18. double operationMoney = 0;
  19. if(valuta == "bitcoin")
  20. {
  21. operationMoney = actives * bitcoin;
  22. }
  23. else if(valuta == "eterum")
  24. {
  25. operationMoney = actives * eterum;
  26. }
  27. else if(valuta == "litecoin")
  28. {
  29. operationMoney = actives * litecoin;
  30. }
  31.  
  32. if(typeV == "Sell")
  33. {
  34. money -= operationMoney;
  35. }
  36. else if(typeV == "Buy")
  37. {
  38. money += operationMoney;
  39. }
  40. commision += operationMoney * coeff;
  41. }
  42. money -= commision;
  43. Console.WriteLine("{0:F16}", money);
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment