Advertisement
musakahero

hotel

Sep 24th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.41 KB | None | 0 0
  1. using System;
  2. using System.Security.AccessControl;
  3. using System.Text;
  4.  
  5.  
  6. namespace ConditionalStatementsAndLoops
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             string month = Console.ReadLine();
  13.             int nightsCount = int.Parse(Console.ReadLine());
  14.             double studio = 0.0;
  15.             double doubleRoom = 0.0;
  16.             double suite = 0.0;
  17.  
  18.             double studioTotal = studio * nightsCount;
  19.             double doubleTotal = doubleRoom * nightsCount;
  20.             double suiteTotal = suite * nightsCount;
  21.  
  22.             if (nightsCount >= 0 || nightsCount >= 200)
  23.             {
  24.                 switch (month)
  25.                 {
  26.                     case "May":
  27.                     case "October":
  28.                         studio = 50;
  29.                         doubleRoom = 65;
  30.                         suite = 75;
  31.                         if (nightsCount > 7)
  32.                         {
  33.                             studio = 50 - (50 * 0.05);
  34.                         }
  35.                         break;
  36.  
  37.                     case "June":
  38.                     case "September":
  39.                         studio = 60;
  40.                         doubleRoom = 72;
  41.                         suite = 82;
  42.                         if (nightsCount > 14)
  43.                         {
  44.                             doubleRoom = 72 - (72 * 0.01);
  45.                         }
  46.                         break;
  47.  
  48.                     case "July":
  49.                     case "August":
  50.                     case "December":
  51.                         studio = 68;
  52.                         doubleRoom = 77;
  53.                         suite = 89;
  54.                         if (nightsCount > 14)
  55.                         {
  56.                             suite = 89 - (89 * 0.15);
  57.                         }
  58.                         break;
  59.                 }
  60.  
  61.                 studioTotal = studio * nightsCount;
  62.                 doubleTotal = doubleRoom * nightsCount;
  63.                 suiteTotal = suite * nightsCount;
  64.  
  65.                 if (month == "September" || month == "October")
  66.                 {
  67.                     studioTotal -= studio;
  68.                 }
  69.  
  70.                 Console.WriteLine($"Studio: {studioTotal:F2} lv.");
  71.                 Console.WriteLine($"Double: {doubleTotal:F2} lv.");
  72.                 Console.WriteLine($"Suite: {suiteTotal:F2} lv.");
  73.             }
  74.         }
  75.     }  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement