Advertisement
dsavov_02

Untitled

Dec 9th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     public static void Main()
  6.     {
  7.         int nights = int.Parse(Console.ReadLine());
  8.         string rooms = Console.ReadLine();
  9.         double price = nights * 70;
  10.         double price1 = nights * 125;
  11.         if(nights <= 10)
  12.         {
  13.             if(rooms == "apartment")
  14.             {
  15.                 Console.WriteLine("{0:F2}", price - 0.3 * price);
  16.             }
  17.             else if (rooms == "president apartment")
  18.             {
  19.                 Console.WriteLine("{0:F2}", price1 - 0.1 * price1);
  20.             }
  21.         }
  22.         else if (nights >=10 && nights <= 15)
  23.         {
  24.             if (rooms == "apartment")
  25.             {
  26.                 Console.WriteLine("{0:F2}", price - 0.35 * price);
  27.             }
  28.             else if (rooms == "president apartment")
  29.             {
  30.                 Console.WriteLine("{0:F2}", price1 - 0.15 * price1);
  31.             }
  32.         }
  33.         else if(nights >= 15)
  34.         {
  35.            
  36.             if (rooms == "apartment")
  37.             {
  38.                 Console.WriteLine("{0:F2}", price - 0.50 * price);
  39.             }
  40.             else if (rooms == "president apartment")
  41.             {
  42.                 Console.WriteLine("{0:F2}", price1 - 0.20 * price1);
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement