Advertisement
Guest User

Untitled

a guest
Jul 8th, 2019
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.68 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ВложениЦиклиУпр_задача_8
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string month = Console.ReadLine();
  10. int nights = int.Parse(Console.ReadLine());
  11.  
  12. double nightInStudio = 0;
  13. double nightInApartment = 0;
  14.  
  15. double totalCost1 = nightInApartment * nights;
  16. double totalCost2 = nightInStudio * nights;
  17.  
  18. if (month == "May" || month == "Octomber")
  19. {
  20. nightInStudio = 50;
  21. nightInApartment = 65;
  22. if (nights > 7 && nights <= 14)
  23. {
  24.  
  25. totalCost2 = nightInStudio * nights;
  26. totalCost2 *= 0.95;
  27.  
  28. }
  29. else if (nights > 14)
  30. {
  31. totalCost1 = nightInApartment * nights;
  32. totalCost2 = nightInStudio * nights;
  33. totalCost2 *= 0.70;
  34. totalCost1 *= 0.90;
  35. }
  36. else if (nights < 7)
  37. {
  38. totalCost1 = nightInApartment * nights;
  39. totalCost2 = nightInStudio * nights;
  40.  
  41. }
  42. }
  43. else if (month == "June" || month == "September")
  44. {
  45. nightInStudio = 75.20;
  46. nightInApartment = 68.70;
  47. if (nights <= 14)
  48. {
  49. totalCost2 = nightInStudio * nights;
  50. totalCost1 = nightInApartment * nights;
  51. }
  52. else if (nights > 14)
  53. {
  54. totalCost2 = nightInStudio * nights;
  55. totalCost1 = nightInApartment * nights;
  56. totalCost2 *= 0.80;
  57. totalCost1 *= 0.90;
  58. }
  59. }
  60.  
  61.  
  62. else if (month == "July" || month == "August")
  63. {
  64. nightInStudio = 76;
  65. nightInApartment = 77;
  66. if (nights > 14)
  67. {
  68. totalCost2 = nightInStudio * nights;
  69. totalCost1 = nightInApartment * nights;
  70. totalCost1 *= 0.90;
  71. }
  72. else if ( nights <= 14)
  73. {
  74. totalCost1 = nightInApartment * nights;
  75. totalCost2 = nightInStudio * nights;
  76. }
  77.  
  78. }
  79. Console.WriteLine($"Apartment: {totalCost1:f2} lv.");
  80. Console.WriteLine($"Studio: {totalCost2:f2} lv.");
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89. }
  90. }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement