skipter

C# Fundamentals - Restaurant Discount

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