Advertisement
milenpi

Trade Comissions

Apr 7th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.36 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace Trade_Comissions
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. string city = Console.ReadLine().ToLower();
  11. double sales = double.Parse(Console.ReadLine());
  12. double comission = -1;
  13. bool isCity = city == "sofia" || city == "varna" || city == "plovdiv";
  14.  
  15. if (!isCity)
  16. {
  17. Console.WriteLine("error");
  18. }
  19. if (comission <0)
  20. {
  21. Console.WriteLine("error");
  22. }
  23. if (city == "sofia")
  24. {
  25. if (0 <= sales && sales <= 500)
  26. {
  27. comission = 0.05;
  28. Console.WriteLine("{0:f2}", sales * comission);
  29. }
  30. else if (500 <= sales && sales <= 1000)
  31. {
  32. comission = 0.07;
  33. Console.WriteLine("{0:f2}", sales * comission);
  34. }
  35.  
  36. else if (1000 <= sales && sales <= 10000)
  37. {
  38. comission = 0.08;
  39. Console.WriteLine("{0:f2}", sales * comission);
  40. }
  41. else if (sales > 10000)
  42. {
  43. comission = 0.12;
  44. Console.WriteLine("{0:f2}", sales * comission);
  45. }
  46. }
  47.  
  48. else if (city == "varna")
  49. {
  50. if (0 <= sales && sales <= 500)
  51. {
  52. comission = 0.045;
  53. Console.WriteLine("{0:f2}", sales * comission);
  54. }
  55. else if (500 <= sales && sales <= 1000)
  56. {
  57. comission = 0.075;
  58. Console.WriteLine("{0:f2}", sales * comission);
  59. }
  60. else if (1000 <= sales && sales <= 10000)
  61. {
  62. comission = 0.1;
  63. Console.WriteLine("{0:f2}", sales * comission);
  64. }
  65. else if (10000 < sales)
  66. {
  67. comission = 0.13;
  68. Console.WriteLine("{0:f2}", sales * comission);
  69. }
  70. }
  71.  
  72. else if (city == "plovdiv")
  73. {
  74. if (0 <= sales && sales <= 500)
  75. {
  76. comission = 0.055;
  77. Console.WriteLine("{0:f2}", sales * comission);
  78. }
  79. else if (500 <= sales && sales <= 1000)
  80. {
  81. comission = 0.08;
  82. Console.WriteLine("{0:f2}", sales * comission);
  83. }
  84. else if (1000 <= sales && sales <= 10000)
  85. {
  86. comission = 0.12;
  87. Console.WriteLine("{0:f2}", sales * comission);
  88. }
  89. else if (10000 < sales)
  90. {
  91. comission = 0.145;
  92. Console.WriteLine("{0:f2}", sales * comission);
  93. }
  94.  
  95. }
  96. }
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement