Advertisement
desislava_topuzakova

Untitled

Dec 11th, 2022
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. int days = int.Parse(Console.ReadLine()) - 1;
  2. string type = Console.ReadLine();
  3. string opinion = Console.ReadLine();
  4.  
  5. double price = 0;
  6.  
  7. if (type == "room for one person")
  8. {
  9.  
  10. price = days * 18;
  11. if (opinion == "positive")
  12. {
  13. price += price * 0.25;
  14. }
  15. else if (opinion == "negative")
  16. {
  17. price -= price * 0.1;
  18. }
  19.  
  20. }
  21. else if (type == "apartment")
  22. {
  23. if (days < 10)
  24. {
  25. price = days * 25;
  26. price -= price * 0.3;
  27. }
  28. else if (days >= 10 && days <= 15)
  29. {
  30.  
  31. price = days * 25;
  32. price -= price * 0.35;
  33. }
  34. else if (days > 15)
  35. {
  36.  
  37. price = days * 25;
  38. price -= price / 2;
  39. }
  40. if (opinion == "positive")
  41. {
  42. price += price * 0.25;
  43. }
  44. else if (opinion == "negative")
  45. {
  46. price -= price * 0.1;
  47. }
  48. }
  49. else if (type == "president apartment")
  50. {
  51. if (days < 10)
  52. {
  53. price = days * 35;
  54. price -= price * 0.1;
  55. }
  56. else if (days >= 10 && days <= 15)
  57. {
  58.  
  59. price = days * 35;
  60. price -= price * 0.15;
  61. }
  62. else if (days > 15)
  63. {
  64.  
  65. price = days * 35;
  66. price -= price * 0.2;
  67. }
  68. if (opinion == "positive")
  69. {
  70. price += price * 0.25;
  71. }
  72. else if (opinion == "negative")
  73. {
  74. price -= price * 0.1;
  75. }
  76. }
  77.  
  78. Console.WriteLine($"{price:F2}");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement