Advertisement
Terziyski

Restourant Discount

May 23rd, 2017
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.56 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. namespace _03.RestaurantDiscount
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             double groupSize = double.Parse(Console.ReadLine());
  13.             string servicePackage = Console.ReadLine();
  14.             double suitablePrice = 1;
  15.             double priceOfPackage = 1;
  16.             double discount = 1;
  17.             string hall = null;
  18.             if (groupSize > 120) Console.WriteLine("We do not have an appropriate hall.");
  19.             else
  20.             {
  21.                 if (groupSize > 100 && groupSize <= 120)
  22.                 {
  23.                     hall = "Great Hall";
  24.                     switch (servicePackage)
  25.                     {
  26.                         case "Normal": discount = 0.95; priceOfPackage = 500; break;
  27.                         case "Gold": discount = 0.9; priceOfPackage = 750; break;
  28.                         case "Platinum": discount = 0.85; priceOfPackage = 1000; break;
  29.                     }
  30.                     suitablePrice = (7500 + priceOfPackage) * discount;
  31.                 }
  32.                 // first change
  33.                 else if (groupSize > 50 && groupSize <= 100)
  34.                 {
  35.                     hall = "Terrace";
  36.                     switch (servicePackage)
  37.                     {
  38.                         case "Normal": discount = 0.95; priceOfPackage = 500; break;
  39.                         case "Gold": discount = 0.9; priceOfPackage = 750; break;
  40.                         case "Platinum": discount = 0.85; priceOfPackage = 1000; break;
  41.                     }
  42.                     suitablePrice = (5000 + priceOfPackage) * discount;
  43.                 }
  44.                 // second change
  45.                 else if (groupSize <= 50)
  46.                 {
  47.                     hall = "Small Hall";
  48.                     switch (servicePackage)
  49.                     {
  50.                         case "Normal": discount = 0.95; priceOfPackage = 500; break;
  51.                         case "Gold": discount = 0.9; priceOfPackage = 750; break;
  52.                         case "Platinum": discount = 0.85; priceOfPackage = 1000; break;
  53.                     }
  54.                     suitablePrice = (2500 + priceOfPackage) * discount;
  55.                 }
  56.                 // third change
  57.                 double pricePerPerson = suitablePrice / groupSize;
  58.                 Console.WriteLine("We can offer you the {0:F2}", hall);
  59.                 Console.WriteLine("The price per person is {0:F2}$", pricePerPerson);
  60.             }
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement