Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2017
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 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
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double weight = double.Parse(Console.ReadLine());
  14. string type = Console.ReadLine();
  15. int distance = int.Parse(Console.ReadLine());
  16.  
  17. var price = 0.00;
  18. var percent = 0.00;
  19. var allPrice = 0.00;
  20.  
  21. if (type == "standart")
  22. {
  23. if (weight<1)
  24. {
  25. price = 0.03;
  26. }
  27. else if (weight >= 1 && weight <= 150)
  28. {
  29. price = 0.05;
  30. }
  31. else if (weight>=11 && weight<=40)
  32. {
  33. price = 0.10;
  34. }
  35. else if (weight >= 41 && weight <= 90)
  36. {
  37. price = 0.15;
  38. }
  39. else if (weight >= 91 && weight <= 150)
  40. {
  41. price = 0.20;
  42. }
  43. }
  44. else if (type == "express")
  45. {
  46. if (weight < 1)
  47. {
  48. price = 0.03;
  49. percent = 80 / 100;
  50. }
  51. else if (weight >= 1 && weight <= 150)
  52. {
  53. price = 0.05;
  54. percent = 40 / 100;
  55.  
  56. }
  57. else if (weight >= 11 && weight <= 40)
  58. {
  59. price = 0.10;
  60. percent = 5 / 100;
  61. }
  62. else if (weight >= 41 && weight <= 90)
  63. {
  64. price = 0.15;
  65. percent = 2 / 100;
  66. }
  67. else if (weight >= 91 && weight <= 150)
  68. {
  69. price = 0.20;
  70. percent = 1 / 100;
  71. }
  72. }
  73.  
  74. allPrice = (price * distance) + price * percent;
  75. Console.WriteLine($"The delivery of your shipment with weight of {weight:f3} kg. would cost {allPrice:f2} lv.");
  76.  
  77. }
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement