Advertisement
Pazzobg

Fundamentals/StatementsAndLoops/3.RestaurantDiscounts

May 24th, 2017
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2.  
  3. public class RestaurantDiscount
  4. {
  5.     public static void Main()
  6.     {
  7.         int customers = int.Parse(Console.ReadLine());
  8.         string service = Console.ReadLine();
  9.         int servicePackPrice = 0;
  10.         string hallType = string.Empty;
  11.         double hallPrice = 0;
  12.         double discount = 0;
  13.  
  14.         switch (service)
  15.         {
  16.             case "Normal": servicePackPrice = 500; discount = 0.95; break;
  17.             case "Gold": servicePackPrice = 750; discount = 0.90; break;
  18.             case "Platinum": servicePackPrice = 1000; discount = 0.85; break;
  19.         }
  20.  
  21.         if (customers <= 50)
  22.         {
  23.             hallPrice = 2500;
  24.             hallType = "Small Hall";
  25.         }
  26.         else if (customers <= 75)
  27.         {
  28.             hallPrice = 5000;
  29.             hallType = "Terrace";
  30.         }
  31.         else if (customers <= 120)
  32.         {
  33.             hallPrice = 7500;
  34.             hallType = "Great Hall";
  35.         }
  36.         else
  37.         {
  38.             Console.WriteLine("We do not have an appropriate hall.");
  39.             Environment.Exit(0);
  40.         }
  41.  
  42.         double totalPriceInclDiscount = (hallPrice + servicePackPrice) * discount;
  43.         double pricePerPerson = totalPriceInclDiscount / customers;
  44.  
  45.         Console.WriteLine($"We can offer you the {hallType}");
  46.         Console.WriteLine($"The price per person is {pricePerPerson:f2}$");
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement