grach

2016_August_28 Hotel Room

Sep 3rd, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.01 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_room
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string month = Console.ReadLine();
  14.             var nights = double.Parse(Console.ReadLine());
  15.  
  16.             var Apartment = 1.0;
  17.             var Studio = 1.0;
  18.  
  19.             if (nights > 14)
  20.             {
  21.                 Apartment *= 0.9;
  22.             }
  23.  
  24.             if ((nights > 14) && ((month == "May") || (month == "October")))
  25.             {
  26.                 Studio *= 0.7;
  27.             }
  28.             else if ((nights > 7) && ((month == "May") || (month == "October")))
  29.             {
  30.                 Studio *= 0.95;
  31.             }
  32.  
  33.                 if ((nights > 14) && ((month == "June") || (month == "September")))
  34.                 {
  35.                     Studio *= 0.8;
  36.                 }
  37.  
  38.                 switch (month)
  39.                 {
  40.                     case "May":
  41.                         Studio *= nights * 50;
  42.                         Apartment *= nights * 65; break;
  43.                     case "October":
  44.                         Studio *= nights * 50;
  45.                         Apartment *= nights * 65; break;
  46.                     case "June":
  47.                         Studio *= nights * 75.20;
  48.                         Apartment *= nights * 68.70; break;
  49.                     case "September":
  50.                         Studio *= nights * 75.20;
  51.                         Apartment *= nights * 68.70; break;
  52.                     case "July":
  53.                         Studio *= nights * 76;
  54.                         Apartment *= nights * 77; break;
  55.                     case "August":
  56.                         Studio *= nights * 76;
  57.                         Apartment *= nights * 77; break;
  58.                 }
  59.  
  60.                 Console.WriteLine("Apartment: {0:f2} lv.", Apartment);
  61.                 Console.WriteLine("Studio: {0:f2} lv.", Studio);
  62.  
  63.             }
  64.         }
  65.     }
Advertisement
Add Comment
Please, Sign In to add comment