grigorb57

Restaurant Discounts

Jul 2nd, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.81 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.  
  7. namespace app1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int people = int.Parse(Console.ReadLine());
  14.  
  15.             string hallName;
  16.             string package = Console.ReadLine();
  17.  
  18.             double totalSum = 0;
  19.             double price = 0;
  20.             double discount = 0;
  21.  
  22.             if (people <= 50)
  23.             {
  24.                 hallName = "Small Hall";
  25.                 price = 2500;
  26.                 Console.WriteLine($"We can offer you the {hallName}");
  27.             }
  28.             else if (people <= 100)
  29.             {
  30.                 hallName = "Terrace";
  31.                 price = 5000;
  32.                 Console.WriteLine($"We can offer you the {hallName}");
  33.             }
  34.             else if (people <= 120)
  35.             {
  36.                 hallName = "Great Hall";
  37.                 price = 7500;
  38.                 Console.WriteLine($"We can offer you the {hallName}");
  39.             }
  40.             else
  41.             {
  42.                 Console.WriteLine("We do not have an appropriate hall.");
  43.                 Environment.Exit(0);
  44.             }
  45.             //Packages
  46.             if (package == "Gold")
  47.             {
  48.                 price += 750;
  49.                 discount = 0.10;
  50.             }
  51.             else if (package == "Normal")
  52.             {
  53.                     price += 500;
  54.                     discount = 0.05;
  55.             }
  56.             else if (package == "Platinum")
  57.             {
  58.                 price += 1000;
  59.                 discount = 0.15;
  60.             }
  61.             totalSum = price - (discount * price);
  62.             Console.WriteLine($"The price per person is {totalSum / people:f2}$");
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment