Advertisement
nevenailievaa

Untitled

Oct 19th, 2022
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.34 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07.HotelRoom
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //Input
  10.             string month = Console.ReadLine();
  11.             int numberStays = int.Parse(Console.ReadLine());
  12.             string typeRoom = null;
  13.             double finalPriceStudio = 0;
  14.             double finalPriceApartment = 0;
  15.  
  16.  
  17.             //Actions
  18.  
  19.             //May and October
  20.             if (month == "May" || month == "October")
  21.             {
  22.                 //Studio
  23.                 finalPriceStudio = numberStays * 50.00;
  24.  
  25.                 if (numberStays > 14)
  26.                 {
  27.                     finalPriceStudio -= finalPriceStudio * 0.3;
  28.                 }
  29.                 else if (numberStays > 7)
  30.                 {
  31.                     finalPriceStudio -= finalPriceStudio * 0.05;
  32.                 }
  33.  
  34.                 //Apartment
  35.                 finalPriceApartment = numberStays * 65.00;
  36.  
  37.                 if (numberStays > 14)
  38.                 {
  39.                     finalPriceApartment -= finalPriceApartment * 0.1;
  40.                 }
  41.             }
  42.  
  43.             //June and September
  44.             if (month == "June" || month == "September")
  45.             {
  46.                 //Studio
  47.                 finalPriceStudio = numberStays * 75.20;
  48.  
  49.                 if (numberStays > 14)
  50.                 {
  51.                     finalPriceStudio -= finalPriceStudio * 0.2;
  52.                 }
  53.  
  54.                 //Apartment
  55.                 finalPriceApartment = numberStays * 68.70;
  56.  
  57.                 if (numberStays > 14)
  58.                 {
  59.                     finalPriceApartment -= finalPriceApartment * 0.1;
  60.                 }
  61.             }
  62.  
  63.             //July and August
  64.             if (month == "July" || month == "August")
  65.             {
  66.                 //Studio
  67.                 finalPriceStudio = numberStays * 76.00;
  68.                
  69.                 //Apartment
  70.                 finalPriceApartment = numberStays * 77.00;
  71.  
  72.                 if (numberStays > 14)
  73.                 {
  74.                     finalPriceApartment -= finalPriceApartment * 0.1;
  75.                 }
  76.             }
  77.  
  78.  
  79.             //Output
  80.             Console.WriteLine($"Apartment: {finalPriceApartment:f2} lv.");
  81.             Console.WriteLine($"Studio: {finalPriceStudio:f2} lv.");
  82.  
  83.  
  84.         }
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement