desislava_topuzakova

3. Ski Vacation

Dec 2nd, 2023
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Security.Cryptography.X509Certificates;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace _05
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14.  
  15. //1. входни данни
  16. int countNights = int.Parse(Console.ReadLine());
  17. string destination = Console.ReadLine(); // "Colorado", "Alps" и "Andie"
  18. string roomType = Console.ReadLine(); // "double room" или "apartment"
  19.  
  20. double pricePerNight = 0; //цена за 1 нощувка (зависи от дестинация и вид на стаята)
  21. if (destination == "Colorado" && roomType == "double room")
  22. {
  23. pricePerNight = 38;
  24. }
  25. else if (destination == "Colorado" && roomType == "apartment")
  26. {
  27. pricePerNight = 45;
  28. }
  29. else if (destination == "Alps" && roomType == "double room")
  30. {
  31. pricePerNight = 35;
  32. }
  33. else if (destination == "Alps" && roomType == "apartment")
  34. {
  35. pricePerNight = 42;
  36. }
  37. else if (destination == "Andie" && roomType == "double room")
  38. {
  39. pricePerNight = 39;
  40. }
  41. else if (destination == "Andie" && roomType == "apartment")
  42. {
  43. pricePerNight = 49;
  44. }
  45.  
  46. //сума за почивка = брой на нощувки * цена за 1 нощувка
  47. double totalPrice = countNights * pricePerNight;
  48.  
  49. Console.WriteLine($"They have to spend {totalPrice:F2} leva.");
  50.  
  51.  
  52. }
  53. }
  54. }
  55.  
  56.  
Advertisement
Add Comment
Please, Sign In to add comment