Advertisement
hrimar

HotelsRoom - from Exam 28 August 2016

Jan 26th, 2017
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace HotelsRoom
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //Programming Basics Exam - 28 August 2016 - HotelsRoom
  10.  
  11.             string month = Console.ReadLine().ToLower();
  12.             int days = int.Parse(Console.ReadLine());
  13.             double studioPrice = days;
  14.             double apartmentPrice = days;
  15.             double discount = 0.0f;
  16.      
  17.  
  18.             var isMayOctober = month == "may" || month == "octоber";
  19.             var isJuneSeptember = month == "june" || month == "september";
  20.             var isJulyAugust = month == "july" || month == "august";
  21.  
  22.             if (isMayOctober)
  23.             {
  24.                 studioPrice *= 50.00f;
  25.                 apartmentPrice *= 65.00f;
  26.             }
  27.             else if (isJuneSeptember)
  28.             {
  29.                 studioPrice *= 75.20f;
  30.                 apartmentPrice *= 68.70f;
  31.             }
  32.             else if (isJulyAugust)
  33.             {
  34.                 studioPrice *= 76.0f;
  35.                 apartmentPrice *= 77.00f;
  36.             }
  37.  
  38.  
  39.             if (days > 14 && isMayOctober)
  40.             {
  41.  
  42.                 discount = 0.30*studioPrice;
  43.                 studioPrice = studioPrice - discount;
  44.             }
  45.             else if (days>7 && isMayOctober)
  46.             {
  47.  
  48.                 discount = 0.05*studioPrice;
  49.                 studioPrice = studioPrice-discount;
  50.             }
  51.          
  52.             else if (days > 14 && isJuneSeptember)
  53.             {
  54.                 discount = 0.20*studioPrice;
  55.                 studioPrice = studioPrice - discount;
  56.             }
  57.             if (days > 14 )
  58.             {
  59.                 discount = 0.10*apartmentPrice;
  60.                 apartmentPrice = apartmentPrice - discount;
  61.             }
  62.             Console.WriteLine($"Apartment: {apartmentPrice:f2} lv.");
  63.             Console.WriteLine($"Studio: {studioPrice:f2} lv.");
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement