Advertisement
Guest User

Четвърта

a guest
Dec 17th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 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. int votes = int.Parse(Console.ReadLine());
  14. double DOGE = 0.07;
  15. double IOTA = 1.44;
  16. double NEO = 28.50;
  17. double ESTD= 25.0;
  18. double totalMarket = 0;
  19. double dC = 0;
  20. double iC = 0;
  21. double nC = 0;
  22. double eC = 0;
  23. double dV = 0;
  24. double iV = 0;
  25. double nV = 0;
  26. double eV = 0;
  27. for (int i = 0; i < votes; i ++)
  28. {
  29. string currency = Console.ReadLine();
  30. double inputValue = Double.Parse(Console.ReadLine());
  31. if (currency == "DOGE")
  32. {
  33. dC += inputValue * DOGE;
  34. dV += 1;
  35. }
  36. if (currency == "IOTA")
  37. {
  38. iC += inputValue * IOTA;
  39. iV += 1;
  40. }
  41. if (currency == "NEO")
  42. {
  43. nC += inputValue * NEO;
  44. nV += 1;
  45. }
  46. if (currency == "ESTD")
  47. {
  48. eC += inputValue * ESTD;
  49. eV += 1;
  50. }
  51. }
  52. totalMarket = dC + iC + nC + eC;
  53. Console.WriteLine($"Total votes = {votes}, Money in market = {totalMarket:f2} EUR");
  54. Console.WriteLine($"DOGE's contribution: {((dC / totalMarket) * 100):f2}%; People who use DOGE: {dV}");
  55. Console.WriteLine($"IOTA's contribution: {((iC / totalMarket) * 100):f2}%; People who use IOTA: {iV}");
  56. Console.WriteLine($"NEO's contribution: {((nC / totalMarket) * 100):f2}%; People who use NEO: {nV}");
  57. Console.WriteLine($"ESTD's contribution: {((eC / totalMarket) * 100):f2}%; People who use ESTD: {eV}");
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement