Guest User

Untitled

a guest
Aug 4th, 2023
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.23 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.            string month = Console.ReadLine();
  10.             int nights= int.Parse(Console.ReadLine());
  11.             double suitePrice = 0;
  12.             double flatPrice = 0;
  13.             double totalSuitePrice = 0;
  14.             double totalFlatPrice = 0;
  15.  
  16.             if (month == "May" || month == "October")
  17.             {
  18.                 suitePrice = nights * 50;
  19.                 flatPrice = nights * 65;
  20.                 if (nights<=7)
  21.                 { totalSuitePrice = suitePrice;
  22.                     totalFlatPrice = flatPrice;
  23.                 }
  24.                 else if ( nights > 7 && nights<=14)
  25.                 { totalSuitePrice = suitePrice - (suitePrice * 0.05);
  26.                     totalFlatPrice = flatPrice;
  27.                 }
  28.                 else if  ( nights > 14)
  29.                 { totalSuitePrice = suitePrice - (suitePrice * 0.3);
  30.                     totalFlatPrice = flatPrice - (flatPrice * 0.1);
  31.                 }
  32.             }
  33.             else if (month == "June" || month == "September")
  34.             {
  35.                 suitePrice = nights * 75.20;
  36.                 flatPrice = nights * 68.70;
  37.  
  38.                 if (nights<=14)
  39.                 { totalSuitePrice = suitePrice;
  40.                     totalFlatPrice = flatPrice;
  41.                 }
  42.             else if ( nights > 14)
  43.                 { totalSuitePrice = suitePrice - (suitePrice * 0.2);
  44.                     totalFlatPrice = flatPrice - (flatPrice * 0.1);
  45.                 }
  46.             }
  47.             else if (month == "July"|| month== "August")
  48.             { suitePrice = nights * 76;
  49.                 flatPrice = nights * 77;
  50.                 if (nights > 14)
  51.                 {
  52.                     totalFlatPrice = flatPrice - (flatPrice * 0.1);
  53.                     totalSuitePrice = suitePrice;
  54.                 }
  55.              else{
  56.                 totalSuitePrice = suitePrice;
  57.                     totalFlatPrice = flatPrice;
  58.                 }
  59.             }
  60.  
  61.            
  62.            
  63.  
  64.             Console.WriteLine($"Apartment: {totalFlatPrice:F2} lv.");
  65.             Console.WriteLine($"Studio: {totalSuitePrice:F2} lv.");
  66.  
  67.         }
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment