Advertisement
VickSuna

Untitled

Feb 18th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _339_Fuel_Tank___Part_2
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string fuelType = Console.ReadLine();
  10. double fuel = double.Parse(Console.ReadLine());
  11. string discountCard = Console.ReadLine();
  12. double priceGasoline = 2.22;
  13. double priceDiesel = 2.33;
  14. double priceGas = 0.93;
  15. double discountGasoline = 0.18;
  16. double discountDiesel = 0.12;
  17. double discountGas = 0.08;
  18. double total = 0;
  19. if (fuelType == "Gasoline" && discountCard == "Yes") // ако зарежда бензин и има карта
  20. {
  21. if (fuel < 20)
  22. {
  23. total = fuel * (priceGasoline - discountGasoline);
  24. }
  25. else if (fuel > 25)
  26. {
  27. total = fuel * (priceGasoline - discountGasoline) * 0.90;
  28. }
  29. else
  30. {
  31. total = fuel * (priceGasoline - discountGasoline) * 0.92;
  32. }
  33. }
  34. else if (fuelType == "Gasoline" && discountCard == "No") // ако зарежда бензин и няма карта
  35. {
  36. if (fuel < 20)
  37. {
  38. total = fuel * priceGasoline;
  39. }
  40. else if (fuel > 25)
  41. {
  42. total = fuel * priceGasoline * 0.90;
  43. }
  44. else
  45. {
  46. total = fuel * priceGasoline * 0.92;
  47. }
  48. }
  49. if (fuelType == "Diesel" && discountCard == "Yes") // ако зарежда дизел и има карта
  50. {
  51. if (fuel < 20)
  52. {
  53. total = fuel * (priceDiesel - discountDiesel);
  54. }
  55. else if (fuel > 25)
  56. {
  57. total = fuel * (priceDiesel - discountDiesel) * 0.90;
  58. }
  59. else
  60. {
  61. total = fuel * (priceDiesel - discountDiesel) * 0.92;
  62. }
  63. }
  64. else if (fuelType == "Diesel" && discountCard == "No") // ако зарежда бензин и няма карта
  65. {
  66. if (fuel < 20)
  67. {
  68. total = fuel * priceDiesel;
  69. }
  70. else if (fuel > 25)
  71. {
  72. total = fuel * priceDiesel * 0.90;
  73. }
  74. else
  75. {
  76. total = fuel * priceDiesel * 0.92;
  77. }
  78. }
  79. if (fuelType == "Gas" && discountCard == "Yes") // ако зарежда газ и има карта
  80. {
  81. if (fuel < 20)
  82. {
  83. total = fuel * (priceGas - discountGas);
  84. }
  85. else if (fuel > 25)
  86. {
  87. total = fuel * (priceGas - discountGas) * 0.90;
  88. }
  89. else
  90. {
  91. total = fuel * (priceGas - discountGas) * 0.92;
  92. }
  93. }
  94. else if (fuelType == "Gas" && discountCard == "No") // ако зарежда газ и няма карта
  95. {
  96. if (fuel < 20)
  97. {
  98. total = fuel * priceGas;
  99. }
  100. else if (fuel > 25)
  101. {
  102. total = fuel * priceGas * 0.90;
  103. }
  104. else
  105. {
  106. total = fuel * priceGas * 0.92;
  107. }
  108. }
  109. Console.WriteLine($"{total:F2} lv.");
  110. }
  111. }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement