kirililchev3

Resturant Discount - if else

May 19th, 2018
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.28 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Exercise2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int groupSize = int.Parse(Console.ReadLine());
  10.             string package = Console.ReadLine();
  11.            
  12.  
  13.             if (groupSize <= 50)
  14.             {
  15.                 string hallName = "Small Hall";
  16.                 double price1 = 2500;
  17.  
  18.                 if (package == "Normal")
  19.                 {
  20.                     double price2 = 500;
  21.                     double totalPrice = (price1 + price2);
  22.                     double discount = totalPrice * 0.05;
  23.                     double finalSum = totalPrice - discount;
  24.                     double pricePerPerson = finalSum / groupSize;
  25.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  26.                 } else if (package == "Gold")
  27.                 {
  28.                     double price2 = 750;
  29.                     double totalPrice = (price1 + price2);
  30.                     double discount = totalPrice * 0.10;
  31.                     double finalSum = totalPrice - discount;
  32.                     double pricePerPerson = finalSum / groupSize;
  33.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  34.                 } else if (package == "Platinum")
  35.                 {
  36.                     double price2 = 1000;
  37.                     double totalPrice = (price1 + price2);
  38.                     double discount = totalPrice * 0.15;
  39.                     double finalSum = totalPrice - discount;
  40.                     double pricePerPerson = finalSum / groupSize;
  41.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  42.                 }
  43.  
  44.             } else if (groupSize > 50 && groupSize <= 100)
  45.             {
  46.                 string hallName = "Terrace";
  47.                 double price1 = 5000;
  48.  
  49.                 if (package == "Normal")
  50.                 {
  51.                     double price2 = 500;
  52.                     double totalPrice = (price1 + price2);
  53.                     double discount = totalPrice * 0.05;
  54.                     double finalSum = totalPrice - discount;
  55.                     double pricePerPerson = finalSum / groupSize;
  56.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  57.                 }
  58.                 else if (package == "Gold")
  59.                 {
  60.                     double price2 = 750;
  61.                     double totalPrice = (price1 + price2);
  62.                     double discount = totalPrice * 0.10;
  63.                     double finalSum = totalPrice - discount;
  64.                     double pricePerPerson = finalSum / groupSize;
  65.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  66.                 }
  67.                 else if (package == "Platinum")
  68.                 {
  69.                     double price2 = 1000;
  70.                     double totalPrice = (price1 + price2);
  71.                     double discount = totalPrice * 0.15;
  72.                     double finalSum = totalPrice - discount;
  73.                     double pricePerPerson = finalSum / groupSize;
  74.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  75.                 }
  76.  
  77.             } else if (groupSize > 100 && groupSize <= 120)
  78.             {
  79.                 string hallName = "Great Hall";
  80.                 double price1 = 7500;
  81.  
  82.                 if (package == "Normal")
  83.                 {
  84.                     double price2 = 500;
  85.                     double totalPrice = (price1 + price2);
  86.                     double discount = totalPrice * 0.05;
  87.                     double finalSum = totalPrice - discount;
  88.                     double pricePerPerson = finalSum / groupSize;
  89.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  90.                 }
  91.                 else if (package == "Gold")
  92.                 {
  93.                     double price2 = 750;
  94.                     double totalPrice = (price1 + price2);
  95.                     double discount = totalPrice * 0.10;
  96.                     double finalSum = totalPrice - discount;
  97.                     double pricePerPerson = finalSum / groupSize;
  98.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  99.                 }
  100.                 else if (package == "Platinum")
  101.                 {
  102.                     double price2 = 1000;
  103.                     double totalPrice = (price1 + price2);
  104.                     double discount = totalPrice * 0.15;
  105.                     double finalSum = totalPrice - discount;
  106.                     double pricePerPerson = finalSum / groupSize;
  107.                     Console.WriteLine($"We can offer you the {hallName} \nThe price per person is {pricePerPerson:f2}{"$"}");
  108.                 }
  109.  
  110.             } else if (groupSize > 120)
  111.             {
  112.                 Console.WriteLine("We do not have an appropriate hall.");
  113.             }
  114.            
  115.            
  116.              
  117.            
  118.         }
  119.     }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment