Advertisement
martinvalchev

Restaurant_Discount

Jan 28th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.79 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Restaurant_Discount
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int countPeople = int.Parse(Console.ReadLine());
  10.             string package = Console.ReadLine();
  11.             string hallName = "";
  12.             double hallPrice = 0;
  13.             double packagePrice = 0;
  14.             double discount = 0;
  15.  
  16.             if (countPeople <= 50)
  17.             {
  18.                 hallPrice = 2500;
  19.                 hallName = "Small Hall";
  20.             }
  21.             else if (countPeople > 50 && countPeople <= 100)
  22.             {
  23.                 hallPrice = 5000;
  24.                 hallName = "Terrace";
  25.             }
  26.             else if (countPeople > 100 && countPeople <= 120)
  27.             {
  28.                 hallPrice = 7500;
  29.                 hallName = "Great Hall";
  30.             } else
  31.             {
  32.                 Console.WriteLine("We do not have an appropriate hall.");
  33.                 return;
  34.             }
  35.  
  36.             if (package.Equals("Normal"))
  37.             {
  38.                 packagePrice = 500;
  39.                 discount = 5;
  40.             }
  41.             else if (package.Equals("Gold"))
  42.             {
  43.                 packagePrice = 750;
  44.                 discount = 10;
  45.             }
  46.             else if (package.Equals("Platinum"))
  47.             {
  48.                 packagePrice = 1000;
  49.                 discount = 15;
  50.             }
  51.  
  52.             double totalPrice = hallPrice + packagePrice;
  53.             double totalDiscount = totalPrice * discount / 100;
  54.             totalPrice -= totalDiscount;
  55.             double pricePerson = totalPrice / countPeople;
  56.  
  57.             Console.WriteLine($"We can offer you the {hallName}");
  58.             Console.WriteLine($"The price per person is {pricePerson:f2}$");
  59.  
  60.  
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement