Advertisement
tsvetelinapasheva

TsvetelinaPasheva/ConditionalStatementsAdvancedLab/13.SkiTrip

Jan 24th, 2021
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.18 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp17
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int day = int.Parse(Console.ReadLine());
  10.             string room = Console.ReadLine();
  11.             string grade = Console.ReadLine();
  12.  
  13.             double price = 0;
  14.             double finalprice = 0;
  15.             double discount = 0;
  16.             double overnight = day - 1;
  17.             double roomForOnePerson = 18;
  18.             double apartment = 25;
  19.             double presidentApartment = 35;
  20.  
  21.             if (room == "room for one person")
  22.             {
  23.                 price = overnight * roomForOnePerson;
  24.             }
  25.             if (room == "apartment")
  26.             {
  27.                 if (day < 10)
  28.                 {
  29.                     price = overnight * apartment;
  30.                     discount = price * 0.30;
  31.                     finalprice = price - discount;
  32.                 }
  33.                 else if (day > 10 && day < 15)
  34.                 {
  35.                     price = overnight * apartment;
  36.                     discount = price * 0.35;
  37.                     finalprice = price - discount;
  38.                 }
  39.                 else if (day > 15)
  40.                 {
  41.                     price = overnight * apartment;
  42.                     discount = price * 0.50;
  43.                     finalprice = price - discount;
  44.                 }
  45.             }
  46.  
  47.             if (room == "president apartment")
  48.             {
  49.                 if (day < 10)
  50.                 {
  51.                     price = overnight * presidentApartment;
  52.                     discount = price * 0.10;
  53.                     finalprice = price - discount;
  54.                 }
  55.                 else if (day > 10 && day < 15)
  56.                 {
  57.                     price = overnight * presidentApartment;
  58.                     discount = price * 0.15;
  59.                     finalprice = price - discount;
  60.                 }
  61.                 else if (day > 15)
  62.                 {
  63.                     price = overnight * presidentApartment;
  64.                     discount = price * 0.20;
  65.                     finalprice = price - discount;
  66.                 }
  67.             }
  68.             if (grade == "positive")
  69.             {
  70.                 if (room == "room for one person")
  71.                 {
  72.                     price = price + (price * 0.25);
  73.                     Console.WriteLine($"{price:f2}");
  74.                 }
  75.                 else if (room == "apartment" || room == "president apartment")
  76.                 {
  77.                     finalprice = finalprice + (finalprice * 0.25);
  78.                     Console.WriteLine($"{finalprice:f2}");
  79.                 }
  80.             }
  81.             else if (grade == "negative")
  82.             {
  83.                 if (room == "room for one person")
  84.                 {
  85.                     price = price - (price * 0.10);
  86.                     Console.WriteLine($"{price:f2}");
  87.                 }
  88.                 else if (room == "apartment" || room == "president apartment")
  89.                 {
  90.                     finalprice = finalprice - (finalprice * 0.10);
  91.                     Console.WriteLine($"{finalprice:f2}");
  92.                 }
  93.             }
  94.         }
  95.     }
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement