Advertisement
Radostta

Hotel

Sep 25th, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.21 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 Hotel
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string month = Console.ReadLine();
  14.             decimal nightsCount = decimal.Parse(Console.ReadLine());
  15.             decimal studioPerNight = 0m;
  16.             decimal doublePerNight = 0m;
  17.             decimal suitePerNight = 0m;
  18.      
  19.             if (month == "May" || month == "October")
  20.             {
  21.                 studioPerNight = 50m;
  22.                 doublePerNight = 65m;
  23.                 suitePerNight = 75m;
  24.  
  25.                 if (nightsCount > 7m)
  26.                 {
  27.                     studioPerNight -= studioPerNight * 0.05m;
  28.                 }              
  29.             }
  30.             else if (month == "June" || month == "September")
  31.             {
  32.                 studioPerNight = 60m;
  33.                 doublePerNight = 72m;
  34.                 suitePerNight = 82m;
  35.  
  36.                 if (nightsCount > 14m)
  37.                 {
  38.                     doublePerNight -= doublePerNight * 0.10m;
  39.                 }
  40.             }
  41.             else if (month == "July" || month == "August" || month == "December")
  42.             {
  43.                 studioPerNight = 68m;
  44.                 doublePerNight = 77m;
  45.                 suitePerNight = 89m;
  46.  
  47.                 if (nightsCount > 14m)
  48.                 {
  49.                     suitePerNight -= suitePerNight * 0.15m;
  50.                 }
  51.             }
  52.  
  53.             decimal studioPrice = 0m;
  54.             decimal doublePrice = doublePerNight * nightsCount;
  55.             decimal suitePrice = suitePerNight * nightsCount;
  56.            
  57.             if (nightsCount > 7m && (month == "September" || month == "October"))
  58.             {
  59.                 studioPrice = studioPerNight * (nightsCount - 1m);
  60.             }
  61.             else
  62.             {
  63.                 studioPrice = studioPerNight * nightsCount;
  64.             }
  65.            
  66.  
  67.             Console.WriteLine($"Studio: {studioPrice:f2} lv.");
  68.             Console.WriteLine($"Double: {doublePrice:f2} lv.");
  69.             Console.WriteLine($"Suite: {suitePrice:f2} lv.");
  70.  
  71.  
  72.         }
  73.     }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement