Advertisement
desislava_topuzakova

3. CHRISTMAS vACATION

Nov 27th, 2022
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _03._ChristmasVacation
  4. {
  5. internal class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. //1. входни данни
  10. int countNights = int.Parse(Console.ReadLine()); //брой на нощувки
  11. string destination = Console.ReadLine(); //дестинация = "Borovets", "Bansko" и "Pamporovo"
  12. string type = Console.ReadLine(); //вид на стаята = "double" или "apartment"
  13.  
  14. //2. цена за 1 нощувка -> дестинация и вид на стаята
  15. int pricePerNight = 0; // цена за 1 нощувка
  16.  
  17. switch (destination)
  18. {
  19. case "Borovets":
  20. //Боровец -> проверка за вид на стаята
  21. if (type == "double")
  22. {
  23. pricePerNight = 38;
  24. }
  25. else if (type == "apartment")
  26. {
  27. pricePerNight = 45;
  28. }
  29. break;
  30. case "Bansko":
  31. //Банско -> проверка за вид на стаята
  32. if (type == "double")
  33. {
  34. pricePerNight = 35;
  35. }
  36. else if (type == "apartment")
  37. {
  38. pricePerNight = 42;
  39. }
  40. break;
  41. case "Pamporovo":
  42. //Пампорово -> проверка за вид на стаята
  43. if (type == "double")
  44. {
  45. pricePerNight = 39;
  46. }
  47. else if (type == "apartment")
  48. {
  49. pricePerNight = 49;
  50. }
  51. break;
  52. }
  53.  
  54.  
  55. //3. крайна цена = брой нощувки * цена за 1 нощувка
  56. int finalPrice = countNights * pricePerNight;
  57. Console.WriteLine($"They have to spend {finalPrice:F2} leva.");
  58.  
  59. }
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement