Advertisement
alphastation

Untitled

Nov 10th, 2017
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 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 _03.Courier_Express
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var weight = double.Parse(Console.ReadLine());
  14. var service = Console.ReadLine();
  15. var distance = int.Parse(Console.ReadLine());
  16.  
  17. var pricePerKilometer = 0.0;
  18. var coststandard = 0.0;
  19. var costexpress = 0.0;
  20. var up = 0.0;
  21. var up2 = 0.0;
  22. var up3 = 0.0;
  23.  
  24. if (service == "standard")
  25. {
  26. if (weight < 1)
  27. {
  28. pricePerKilometer = 0.03;
  29. coststandard = distance * pricePerKilometer;
  30. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {coststandard:f2} lv.");
  31. }
  32.  
  33.  
  34. else if (weight >= 1 && weight <= 10)
  35. {
  36. pricePerKilometer = 0.05;
  37. coststandard = distance * pricePerKilometer;
  38. Console.WriteLine("The delivery of your shipment with weight of {0:f3} kg. would cost {1:f2} lv.", weight, coststandard);
  39. }
  40.  
  41.  
  42. else if (weight >= 11 && weight <= 40)
  43. {
  44. pricePerKilometer = 0.10;
  45. coststandard = distance * pricePerKilometer;
  46. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {coststandard:f2} lv.");
  47. }
  48.  
  49.  
  50. else if (weight >= 41 && weight <= 90)
  51. {
  52. pricePerKilometer = 0.15;
  53. coststandard = distance * pricePerKilometer;
  54. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {coststandard:f2} lv.");
  55. }
  56.  
  57.  
  58. else if (weight >= 91 && weight <= 150)
  59. {
  60. pricePerKilometer = 0.20;
  61. coststandard = distance * pricePerKilometer;
  62. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {coststandard:f2} lv.");
  63. }
  64. }
  65. else if (service == "express")
  66. {
  67. if (weight < 1)
  68. {
  69. pricePerKilometer = 0.03;
  70. coststandard = distance * pricePerKilometer;
  71. up = 0.80 * pricePerKilometer;
  72. up2 = distance * up;
  73. up3 = weight * up2;
  74. costexpress = coststandard + up3;
  75. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {costexpress:f2} lv.");
  76. }
  77. else if (weight >= 1 && weight <= 10)
  78. {
  79. pricePerKilometer = 0.05;
  80. coststandard = distance * pricePerKilometer;
  81. up = 0.40 * pricePerKilometer;
  82. up2 = distance * up;
  83. up3 = weight * up2;
  84. costexpress = coststandard + up3;
  85. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {costexpress:f2} lv.");
  86. }
  87. else if (weight >= 11 && weight <= 40)
  88. {
  89. pricePerKilometer = 0.10;
  90. coststandard = distance * pricePerKilometer;
  91. up = 0.05 * pricePerKilometer;
  92. up2 = distance * up;
  93. up3 = weight * up2;
  94. costexpress = coststandard + up3;
  95. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {costexpress:f2} lv.");
  96. }
  97. else if (weight >= 41 && weight <= 90)
  98. {
  99. pricePerKilometer = 0.15;
  100. coststandard = distance * pricePerKilometer;
  101. up = 0.02 * pricePerKilometer;
  102. up2 = distance * up;
  103. up3 = weight * up2;
  104. costexpress = coststandard + up3;
  105. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {costexpress:f2} lv.");
  106. }
  107. else if (weight >= 91 && weight <= 150)
  108. {
  109. pricePerKilometer = 0.20;
  110. coststandard = distance * pricePerKilometer;
  111. up = 0.01 * pricePerKilometer;
  112. up2 = distance * up;
  113. up3 = weight * up2;
  114. costexpress = coststandard + up3;
  115. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {costexpress:f2} lv.");
  116. }
  117. }
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125. }
  126. }
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement