Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.14 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace Hotel
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string month = Console.ReadLine().ToLower();
  11.             int nights = int.Parse(Console.ReadLine());
  12.  
  13.             double priceStudio = 0.0;
  14.             double priceApartament = 0.0;
  15.  
  16.             if (month=="july"||month=="august")
  17.             {
  18.  
  19.                 double nightStudio = 76.0;
  20.                 double nightApartament = 77.00;
  21.                 priceStudio = nights * nightStudio;
  22.                 priceApartament = nights * nightApartament;
  23.  
  24.                 if(nights>14)
  25.                 {
  26.                     priceApartament -= priceApartament * 0.10;
  27.                 }
  28.  
  29.             }
  30.  
  31.      
  32.  
  33.                 else if (month == "may" || month == "october")
  34.                 {
  35.                     double nightStudio = 50.0;
  36.                     double nightApartament = 65.00;
  37.  
  38.                     priceStudio = (nights * nightStudio);
  39.                 priceApartament = (nights * nightApartament);
  40.                     if (nights>14)
  41.                     {
  42.                        priceStudio -= priceStudio * 0.30;
  43.                       priceApartament -= priceApartament * 0.10;
  44.                      }
  45.                     else if (nights>7)
  46.                      {
  47.                      priceStudio -= priceStudio * 0.05;
  48.                       }    
  49.                 }
  50.  
  51.                 else if (month == "june" || month == "september")
  52.                 {
  53.                     double nightStudio = 75.20;
  54.                     double nightApartament = 68.70;
  55.                     priceStudio = (nights * nightStudio);
  56.                     priceApartament = (nights * nightApartament);
  57.  
  58.                     if (nights>14)
  59.                      {
  60.                          priceStudio -= priceStudio * 0.20;
  61.                             priceApartament -= priceApartament*0.10;
  62.                       }
  63.  
  64.                  }
  65.  
  66.  
  67.             Console.WriteLine("Apartment: {0:f2} lv.", Math.Round(priceApartament, 2));
  68.             Console.WriteLine("Studio: {0:f2} lv.", Math.Round(priceStudio, 2));
  69.         }
  70.     }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement