Advertisement
spasnikolov131

Untitled

May 15th, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Fuel_Tank___Part_2
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double benzin = 2.22;
  10. double dizel = 2.33;
  11. double gaz = 0.93;
  12. double discountBenzin = 0.18;
  13. double discountDizel = 0.12;
  14. double discountGaz = 0.08;
  15. string fuel = Console.ReadLine();
  16. double liters = double.Parse(Console.ReadLine());
  17. string clubCard = Console.ReadLine();
  18. double price = 0;
  19. double totalPrice = 0;
  20. bool clubCardd = false;
  21.  
  22. if (clubCard == "Yes")
  23. {
  24. clubCardd = true;
  25. }
  26. else
  27. {
  28. clubCardd = false;
  29. }
  30. switch (fuel)
  31. {
  32. case
  33. "Gasoline":
  34. price = benzin - discountBenzin;
  35. break;
  36. case
  37. "Diesel":
  38. price = dizel - discountDizel;
  39. break;
  40. case
  41. "Gas":
  42. price = gaz - discountGaz;
  43. break;
  44. }
  45. if (clubCard == "No")
  46. {
  47. switch (fuel)
  48. {
  49. case "Gasoline":
  50. price = benzin;
  51. break;
  52. case "Diesel":
  53. price = dizel;
  54. break;
  55. case "Gas" :
  56. price = gaz;
  57. break;
  58. }
  59. }
  60. if (liters >= 25)
  61. {
  62. totalPrice = liters * price - ((10 * price)/100);
  63. }
  64. else if (liters >= 20)
  65. {
  66. totalPrice = liters * price - ((8 * price) / 100);
  67. }
  68. else
  69. {
  70. totalPrice = liters * price;
  71. }
  72. Console.WriteLine($"{totalPrice:f2} lv.");
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement