Advertisement
knikolov98

Untitled

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