veronikaaa86

03. Restaurant Discount

Jan 31st, 2018
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.73 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 Ex3_RestaurantDiscount
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int groupSize = int.Parse(Console.ReadLine());
  14.             string package = Console.ReadLine();
  15.  
  16.             double discount = 0;
  17.             double sum = 0;
  18.             string hall = "";
  19.  
  20.             if (groupSize<=50)
  21.             {
  22.                 hall = "Small Hall";
  23.                 if ("Normal".Equals(package))
  24.                 {
  25.                     sum = 2500 + 500;
  26.                     discount = sum - (sum * 0.05);
  27.                 }
  28.                 else if ("Gold".Equals(package))
  29.                 {
  30.                     sum = 2500 + 750;
  31.                     discount = sum - (sum * 0.10);
  32.                 }
  33.                 else if ("Platinum".Equals(package))
  34.                 {
  35.                     sum = 2500 + 1000;
  36.                     discount = sum - (sum * 0.15);
  37.                 }
  38.             }
  39.             else if (groupSize <= 100)
  40.             {
  41.                 hall = "Terrace";
  42.                 if ("Normal".Equals(package))
  43.                 {
  44.                     sum = 5000 + 500;
  45.                     discount = sum - (sum * 0.05);
  46.                 }
  47.                 else if ("Gold".Equals(package))
  48.                 {
  49.                     sum = 5000 + 750;
  50.                     discount = sum - (sum * 0.10);
  51.                 }
  52.                 else if ("Platinum".Equals(package))
  53.                 {
  54.                     sum = 5000 + 1000;
  55.                     discount = sum - (sum * 0.15);
  56.                 }
  57.             }
  58.             else if (groupSize <= 120)
  59.             {
  60.                 hall = "Great Hall";
  61.                 if ("Normal".Equals(package))
  62.                 {
  63.                     sum = 7500 + 500;
  64.                     discount = sum - (sum * 0.05);
  65.                 }
  66.                 else if ("Gold".Equals(package))
  67.                 {
  68.                     sum = 7500 + 750;
  69.                     discount = sum - (sum * 0.10);
  70.                 }
  71.                 else if ("Platinum".Equals(package))
  72.                 {
  73.                     sum = 7500 + 1000;
  74.                     discount = sum - (sum * 0.15);
  75.                 }
  76.             }
  77.  
  78.             double sumPerPerson = discount / groupSize;
  79.             if (groupSize<=120)
  80.             {
  81.                 Console.WriteLine($"We can offer you the {hall}");
  82.                 Console.WriteLine("The price per person is {0:F2}$", sumPerPerson);
  83.             }
  84.             else
  85.             {
  86.                 Console.WriteLine("We do not have an appropriate hall.");
  87.             }
  88.         }
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment