VelizarAvramov

03. Restaurant Discount

Nov 5th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.73 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Demo
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //A restaurant want to automate their reservation process. They need a program that reads the hall and the count of people
  10.             //from the console and calculates how much the customer should pay to book the place.
  11.             int groupSize = int.Parse(Console.ReadLine());
  12.             string package = Console.ReadLine();
  13.             string hall = "";
  14.             double price = 0;
  15.             if (groupSize > 120)
  16.             {
  17.                 Console.WriteLine("We do not have an appropriate hall.");
  18.                 return;
  19.             }
  20.  
  21.             if (groupSize <= 50)
  22.             {
  23.                 price += 2500;
  24.                 hall = "Small Hall";
  25.             }
  26.             else if (groupSize <= 100)
  27.             {
  28.                 price += 5000;
  29.                 hall = "Terrace";
  30.             }
  31.             else if (groupSize <= 120)
  32.             {
  33.                 price += 7500;
  34.                 hall = "Great Hall";
  35.             }
  36.             switch (package)
  37.             {
  38.                 case "Normal":
  39.                     price += 500;
  40.                     price *= 0.95;
  41.                     break;
  42.                 case "Gold":
  43.                     price += 750;
  44.                     price *= 0.90;
  45.                     break;
  46.                 case "Platinum":
  47.                     price += 1000;
  48.                     price *= 0.85;
  49.                     break;
  50.  
  51.                 default:
  52.                     break;
  53.             }
  54.             Console.WriteLine($"We can offer you the {hall}");
  55.             Console.WriteLine($"The price per person is {price/groupSize:f2}$");
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment