Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
117
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.  
  3. namespace FuelTank_2
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string fuelType = Console.ReadLine();
  10. double fuelLittres = double.Parse(Console.ReadLine());
  11. string clubCard = Console.ReadLine();
  12. double gasolinePrice = 2.22;
  13. double dieselPrice = 2.33;
  14. double gasPrice = 0.93;
  15. double gasolineDisc = 0.18;
  16. double dieselDisc = 0.12;
  17. double gasDisc = 0.08;
  18. double totalPrice = 0.0;
  19. if (clubCard == "Yes")
  20. {
  21. switch (fuelType)
  22. {
  23. case "Gasoline":
  24. totalPrice = fuelLittres *( gasolinePrice - gasolineDisc);
  25. break;
  26. case "Diesel":
  27. totalPrice = fuelLittres * (dieselPrice * dieselDisc);
  28. break;
  29. case "Gas":
  30. totalPrice = fuelLittres * (gasPrice- gasDisc);
  31. break;
  32. }
  33. if (fuelLittres >= 20 && fuelLittres <= 25)
  34. {
  35. totalPrice *= 0.92;
  36. }
  37. else if (fuelLittres > 25)
  38. {
  39. totalPrice *= 0.9;
  40. }
  41. }
  42. else
  43. {
  44. switch (fuelType)
  45. {
  46. case "Gasoline":
  47. totalPrice = fuelLittres * gasolinePrice;
  48. break;
  49. case "Diesel":
  50. totalPrice = fuelLittres * dieselPrice;
  51. break;
  52. case "Gas":
  53. totalPrice = fuelLittres * gasPrice;
  54. break;
  55. }
  56. if (fuelLittres >= 20 && fuelLittres <= 25)
  57. {
  58. totalPrice *= 0.92;
  59. }
  60. else if (fuelLittres > 25)
  61. {
  62. totalPrice *= 0.9;
  63. }
  64. }
  65. Console.WriteLine($"{totalPrice:f2} lv.");
  66. }
  67. }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement