Advertisement
TodorovP

19 Room in Hotel

Feb 3rd, 2018
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Room_in_Hotel_19
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var month = Console.ReadLine(); // месец
  14.             var overnights = int.Parse(Console.ReadLine()); // # нощувки
  15.  
  16.             double priceApp = 0;
  17.             double priceStudio = 0;
  18.  
  19.             switch (month)
  20.             {
  21.                 case "May": priceStudio = 50; break;
  22.                 case "June": priceStudio = 75.20; break;
  23.                 case "July": priceStudio = 76; break;
  24.                 case "August": priceStudio = 76; break;
  25.                 case "September": priceStudio = 75.20; break;
  26.                 case "October": priceStudio = 50; break;
  27.                 default: break;
  28.             }
  29.  
  30.             switch (month)
  31.             {
  32.                 case "May": priceApp = 65; break;
  33.                 case "June": priceApp = 68.70; break;
  34.                 case "July": priceApp = 77; break;
  35.                 case "August": priceApp = 77; break;
  36.                 case "September": priceApp = 68.70; break;
  37.                 case "October": priceApp = 65; break;
  38.             }
  39.  
  40.             if (((overnights > 7) && (overnights <= 14))
  41.                 && ((month == "May") || (month == "October")))
  42.             {
  43.                 priceStudio = priceStudio * (1 - 0.05);
  44.             }
  45.             if ((overnights > 14) && ((month == "May") || (month == "October")))
  46.             {
  47.                 priceStudio = priceStudio * (1 - 0.30);
  48.             }
  49.             if ((overnights > 14) && ((month == "June") || (month == "September")))
  50.             {
  51.                 priceStudio = priceStudio * (1 - 0.20);
  52.             }
  53.             if (overnights > 14)
  54.             {
  55.                 priceApp = priceApp * (1 - 0.10);
  56.             }
  57.  
  58.             double sumApp = priceApp * overnights;
  59.             double sumStudio = priceStudio * overnights;
  60.  
  61.             Console.WriteLine($"Apartment: {sumApp:f2} lv.");
  62.             Console.WriteLine($"Studio: {sumStudio:f2} lv.");
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement