Advertisement
DaniPasteBin

Untitled

May 25th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.70 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _4.Hotel
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string month = Console.ReadLine();
  10.             int nights = int.Parse(Console.ReadLine());
  11.  
  12.  
  13.             /*double totalPriceStudio = 0;
  14.             double totalPriceDoubleRoom = 0;
  15.             double totalPriceSuite = 0;*/
  16.  
  17.  
  18.             /*if (nights > 14)
  19.             {
  20.                 switch (month)
  21.                 {
  22.  
  23.                     case "October":
  24.                     case "May":
  25.                         studio = 50;
  26.                         doubleRoom = 65;
  27.                         suite = 75;
  28.                         break;
  29.                     case "September":
  30.                     case "June":
  31.                         studio = 60;
  32.                         doubleRoom = 72;
  33.                         suite = 82;
  34.                         break;
  35.                     case "July":
  36.                     case "August":
  37.                     case "December":
  38.                         studio = 68;
  39.                         doubleRoom = 77;
  40.                         suite = 89;
  41.                         break;
  42.                 }
  43.  
  44.             }
  45.             else if (nights > 7)
  46.             {
  47.                 switch (month)
  48.                 {
  49.  
  50.                     case "May":
  51.                     case "October":
  52.                         studio = 50;
  53.                         doubleRoom = 65;
  54.                         suite = 75;
  55.                         break;
  56.                     case "June":
  57.                     case "September":
  58.                         studio = 60;
  59.                         doubleRoom = 72;
  60.                         suite = 82;
  61.                         break;
  62.                     case "July":
  63.                     case "August":
  64.                     case "December":
  65.                         studio = 68;
  66.                         doubleRoom = 77;
  67.                         suite = 89;
  68.                         break;
  69.                 }
  70.             }*/
  71.  
  72.  
  73.  
  74.             if (month == "May" || month == "October")
  75.             {
  76.                 int studio = 50;
  77.                 int doubleRoom = 65;
  78.                 int suite = 75;
  79.  
  80.                 if (nights > 7)
  81.                 {
  82.                     double discount = 0.05;
  83.  
  84.                    
  85.                     if (month == "October")
  86.                     {
  87.                         double totalPriceStudio = (studio * (1 - discount)) * (nights-1);
  88.                         double totalPriceDoubleRoom = doubleRoom * nights;
  89.                         double totalPriceSuite = suite * nights;
  90.  
  91.                         Console.WriteLine($"Studio: {totalPriceStudio:f2} lv.");
  92.                         Console.WriteLine($"Double: {totalPriceDoubleRoom:f2} lv.");
  93.                         Console.WriteLine($"Suite: {totalPriceSuite:f2} lv.");
  94.                     }
  95.                     else
  96.                     {
  97.                         double totalPriceStudio = (studio * (1 - discount)) * (nights);
  98.                         double totalPriceDoubleRoom = doubleRoom * nights;
  99.                         double totalPriceSuite = suite * nights;
  100.  
  101.                         Console.WriteLine($"Studio: {totalPriceStudio:f2} lv.");
  102.                         Console.WriteLine($"Double: {totalPriceDoubleRoom:f2} lv.");
  103.                         Console.WriteLine($"Suite: {totalPriceSuite:f2} lv.");
  104.                     }
  105.  
  106.                 }
  107.                
  108.  
  109.  
  110.             }
  111.  
  112.             else if (month == "June" || month == "September")
  113.             {
  114.                 int studio = 60;
  115.                 int doubleRoom = 72;
  116.                 int suite = 82;
  117.  
  118.  
  119.  
  120.                 if (nights > 14 && month == "June")
  121.                 {
  122.  
  123.                     double totalPriceStudio = studio * nights;
  124.                     double totalPriceDoubleRoom = doubleRoom * (1 - 0.10) * nights;
  125.                     double totalPriceSuite = suite * nights;
  126.  
  127.                     Console.WriteLine($"Studio: {totalPriceStudio:f2} lv.");
  128.                     Console.WriteLine($"Double: {totalPriceDoubleRoom:f2} lv.");
  129.                     Console.WriteLine($"Suite: {totalPriceSuite:f2} lv.");
  130.  
  131.                 }
  132.                 else if (month == "September" && nights > 7)
  133.                 {
  134.                     double totalPriceStudio = studio * (nights - 1);
  135.                     double totalPriceDoubleRoom = doubleRoom * nights;
  136.                     double totalPriceSuite = suite * nights;
  137.  
  138.                     Console.WriteLine($"Studio: {totalPriceStudio:f2} lv.");
  139.                     Console.WriteLine($"Double: {totalPriceDoubleRoom:f2} lv.");
  140.                     Console.WriteLine($"Suite: {totalPriceSuite:f2} lv.");
  141.                 }
  142.                 else if (month == "September" && nights > 14)
  143.                 {
  144.                     double totalPriceStudio = studio * nights;
  145.                     double totalPriceDoubleRoom = doubleRoom * (1 -0.10) * nights;
  146.                     double totalPriceSuite = suite * nights;
  147.  
  148.                     Console.WriteLine($"Studio: {totalPriceStudio:f2} lv.");
  149.                     Console.WriteLine($"Double: {totalPriceDoubleRoom:f2} lv.");
  150.                     Console.WriteLine($"Suite: {totalPriceSuite:f2} lv.");
  151.                 }
  152.                 else
  153.                 {
  154.                     double totalPriceStudio = studio * nights;
  155.                     double totalPriceDoubleRoom = doubleRoom *  nights;
  156.                     double totalPriceSuite = suite * nights;
  157.  
  158.                     Console.WriteLine($"Studio: {totalPriceStudio:f2} lv.");
  159.                     Console.WriteLine($"Double: {totalPriceDoubleRoom:f2} lv.");
  160.                     Console.WriteLine($"Suite: {totalPriceSuite:f2} lv.");
  161.                 }
  162.  
  163.             }
  164.             else if (month == "July" || month == "August" || month == "December")
  165.             {
  166.                 int studio = 68;
  167.                 int doubleRoom = 77;
  168.                 int suite = 89;
  169.  
  170.                 if (nights > 14)
  171.                 {
  172.  
  173.                     double totalPriceStudio = studio * nights;
  174.                     double totalPriceDoubleRoom = doubleRoom * nights;
  175.                     double totalPriceSuite = suite * nights* (1 -0.15);
  176.  
  177.                     Console.WriteLine($"Studio: {totalPriceStudio:f2} lv.");
  178.                     Console.WriteLine($"Double: {totalPriceDoubleRoom:f2} lv.");
  179.                     Console.WriteLine($"Suite: {totalPriceSuite:f2} lv.");
  180.                 }
  181.  
  182.             }
  183.  
  184.  
  185.             // Console.WriteLine($"Studio: {totalPriceStudio} lv.");
  186.             //Console.WriteLine($"Double: {totalPriceDoubleRoom} lv.");
  187.             //Console.WriteLine($"Suite: {totalPriceSuite} lv.");
  188.  
  189.            
  190.         }
  191.     }
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement