Advertisement
knikolov98

Untitled

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