IvetValcheva

07. Hotel Room

Nov 15th, 2021
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.65 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string mounth = Console.ReadLine(); //May, June, July, August, September или October
  10.             int nights = int.Parse(Console.ReadLine());
  11.  
  12.             double studioPrice =0;
  13.             double apartamentPrice =0;
  14.  
  15.  
  16.             if (mounth == "May" || mounth== "October")
  17.             {
  18.                 studioPrice = nights * 50;
  19.                 apartamentPrice = nights * 65;
  20.  
  21.                 if (nights > 14)
  22.                 {
  23.                     apartamentPrice -= apartamentPrice * 0.10;
  24.                     studioPrice -= studioPrice * 0.30;
  25.                 }
  26.                 else if(nights > 7)
  27.                 {
  28.                     studioPrice -= studioPrice * 0.05;
  29.                 }
  30.  
  31.             }
  32.             else if (mounth =="June" || mounth == "September")
  33.             {
  34.                 studioPrice = nights * 75.20;
  35.                 apartamentPrice = nights * 68.70;
  36.                 if (nights > 14)
  37.                 {
  38.                     apartamentPrice -= apartamentPrice * 0.10;
  39.                     studioPrice -= studioPrice * 0.20;
  40.                 }
  41.             }
  42.             else
  43.             {
  44.                 studioPrice = nights * 76;
  45.                 apartamentPrice = nights * 77;
  46.                 if(nights > 14)
  47.                 {
  48.                     apartamentPrice -= apartamentPrice * 0.10;
  49.                 }
  50.             }
  51.  
  52.             Console.WriteLine($"Apartment: {apartamentPrice:F2} lv.");
  53.             Console.WriteLine($"Studio: {studioPrice:F2} lv.");
  54.  
  55.         }
  56.     }
  57. }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment