IvanBorisovG

Restaurant

Jan 25th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.65 KB | None | 0 0
  1. using System;
  2.  
  3. namespace RestaurantDiscount
  4. {
  5.     class RestaurantDiscount
  6.     {
  7.         static void Main()
  8.         {
  9.             decimal groupSize = decimal.Parse(Console.ReadLine());
  10.             string package = Console.ReadLine().ToLower();
  11.             string hall = "";
  12.             decimal price = 0.0m;
  13.  
  14.             if (groupSize <= 50)
  15.             {
  16.                 hall = "Small Hall";
  17.                 price = 2500.0m;
  18.             }
  19.             else if (groupSize <= 100 && groupSize > 50)
  20.             {
  21.                 hall = "Terrace";
  22.                 price = 5000.0m;
  23.             }
  24.             else if (groupSize <= 120 && groupSize > 100)
  25.             {
  26.                 hall = "Great Hall";
  27.                 price = 7500.0m;
  28.             }
  29.             else
  30.             {
  31.                 Console.WriteLine("We do not have an appropriate hall.");
  32.                 return;
  33.             }
  34.             decimal discount = 0.0m;
  35.             switch (package)
  36.             {
  37.                 case "normal":
  38.                     price += 500.0m;
  39.                     discount = price * 0.5m;
  40.                     break;
  41.                 case "gold":
  42.                     price += 750.0m;
  43.                     discount = price * 0.10m;
  44.                     break;
  45.                 case "platinum":
  46.                     price += 1000.0m;
  47.                     discount = price * 0.15m;
  48.                     break;
  49.             }
  50.             decimal totalPrice = (price - discount) / groupSize;
  51.             Console.WriteLine($"We can offer you the {hall}");
  52.             Console.WriteLine($"The price per person is {totalPrice:F2}$");
  53.  
  54.         }
  55.     }
  56. }
Add Comment
Please, Sign In to add comment