Advertisement
ShadowLordBG

03. Santas Holiday

Feb 24th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace exam
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int days = int.Parse(Console.ReadLine());
  14.             string room = Console.ReadLine();
  15.             string grade = Console.ReadLine();
  16.             double roomOne = 18.00;
  17.             double apartment = 25.00;
  18.             double president = 35.00;
  19.             double discount = 0;
  20.             double all = 0;
  21.             int nights = days - 1;
  22.  
  23.             if (room== "room for one person")
  24.             {
  25.  
  26.                 if ((days < 10) || (days >= 10 && days <= 15) || (days > 15))
  27.                 {
  28.                      discount = nights * roomOne;
  29.                 }
  30.              
  31.             }
  32.             if (room == "apartment")
  33.             {
  34.                 if (days<10)
  35.                 {
  36.                     double priceNights = nights * apartment;
  37.                      discount = priceNights * 0.7;
  38.                 }
  39.                 else if (days>=10 && days<=15)
  40.                 {
  41.                     double priceNights = nights * apartment;
  42.                    double  discount2 = priceNights * 0.35;
  43.                     discount = priceNights - discount2;
  44.                 }
  45.                 else if (days>15)
  46.                 {
  47.                     double priceNights = nights * apartment;
  48.                     double discount2 = priceNights * 0.5;
  49.                     discount = priceNights -discount2;
  50.                 }
  51.                
  52.             }
  53.             if (room == "president apartment")
  54.             {
  55.                 if (days < 10)
  56.                 {
  57.                     double priceNights = nights * president;
  58.                     double discount2 = priceNights * 0.9;
  59.                     discount = priceNights - discount2;
  60.                 }
  61.                 else if (days >= 10 && days <= 15)
  62.                 {
  63.                     double priceNights = nights * president;
  64.                    
  65.                     double discount2 = priceNights * 0.85;
  66.                     discount = priceNights - discount2;
  67.                 }
  68.                 else if (days > 15)
  69.                 {
  70.                     double priceNights = nights * president;
  71.                    
  72.                     double discount2 = priceNights * 0.2;
  73.                     discount = priceNights - discount2;
  74.                 }
  75.  
  76.             }
  77.             if (grade == "positive")
  78.             {
  79.                  all = discount + (discount * 0.25);
  80.             }
  81.             else if (grade == "negative")
  82.             {
  83.                  all = discount - (discount * 0.10);
  84.             }
  85.             Console.WriteLine("{0:F2}",all);
  86.         }
  87.  
  88.     }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement