Advertisement
em3ata

Ski Trip

Aug 29th, 2019
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.21 KB | None | 0 0
  1. using System;
  2.  
  3. namespace skivacation
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int stay = int.Parse(Console.ReadLine());
  10.             string roomType = Console.ReadLine();
  11.             string opinion = Console.ReadLine();
  12.             double price = 0;
  13.             int night = stay - 1;
  14.             if (roomType == "singleRoom")
  15.             {
  16.                 if (stay < 10)
  17.                 {
  18.                     price = night * 18;
  19.                 }
  20.                 else if (stay >= 10 && stay <= 15)
  21.                 {
  22.                     price = night * 18;
  23.                 }
  24.                 else if (stay > 15)
  25.                 {
  26.                     price = night * 18;
  27.  
  28.                 }
  29.             }
  30.             else if (roomType == "apartment")
  31.             {
  32.                 if (stay < 10)
  33.                 {
  34.                     price = night * 25;
  35.                     price = price - price * 0.30;
  36.                 }
  37.                 else if (stay >= 10 && stay <= 15)
  38.                 {
  39.                     price = night * 25;
  40.                     price = price - price * 0.35;
  41.                 }
  42.                 else if (stay > 15)
  43.                 {
  44.                     price = night * 25;
  45.                     price = price - price * 0.50;
  46.                 }
  47.             }
  48.             else if (roomType == "president apartment")
  49.             {
  50.                 if (stay < 10)
  51.                 {
  52.                     price = night * 35;
  53.                     price = price - price * 0.10;
  54.                 }
  55.                 else if (stay >= 10 && stay <= 15)
  56.                 {
  57.                     price = night * 35;
  58.                     price = price - price * 0.15;
  59.                 }
  60.                 else if (stay > 15)
  61.                 {
  62.                     price = night * 35;
  63.                     price = price - price * 0.20;
  64.                 }
  65.             }
  66.             if (opinion=="positive")
  67.             {
  68.                 price=price+price*0.25;
  69.                 Console.WriteLine($"{price:f2}");
  70.             }
  71.             else
  72.             {
  73.                 Console.WriteLine($"{price - price * 0.10:F2}");
  74.             }
  75.         }
  76.     }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement