Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _03_Restaurant_Discount
- {
- class Program
- {
- static void Main(string[] args)
- {
- int GroupSize = int.Parse(Console.ReadLine());
- string Package = Console.ReadLine();
- double Price = 0;
- double discount = 0;
- double packagePrice = 0;
- CalcDiscountPackage(Package, out discount, out packagePrice);
- if (GroupSize <= 50)
- {
- Price = 2500;
- double PricePerPerson = CalcPricePerPerson(GroupSize, Price, discount, packagePrice);
- Console.WriteLine("We can offer you the Small Hall");
- Console.WriteLine($"The price per person is {PricePerPerson:f2}$");
- }
- else if (50 < GroupSize && GroupSize <= 100)
- {
- Price = 5000;
- double PricePerPerson = CalcPricePerPerson(GroupSize, Price, discount, packagePrice);
- Console.WriteLine("We can offer you the Terrace");
- Console.WriteLine($"The price per person is {PricePerPerson:f2}$");
- }
- else if (100 < GroupSize && GroupSize <= 120)
- {
- Price = 7500;
- double PricePerPerson = CalcPricePerPerson(GroupSize, Price, discount, packagePrice);
- Console.WriteLine("We can offer you the Great Hall");
- Console.WriteLine($"The price per person is {PricePerPerson:f2}$");
- }
- else
- {
- Console.WriteLine("We do not have an appropriate hall.");
- }
- }
- private static double CalcPricePerPerson(int GroupSize, double Price, double discount, double packagePrice)
- {
- return (Price + packagePrice) * (1 - discount) / GroupSize;
- }
- private static void CalcDiscountPackage(string Package, out double discount, out double packagePrice)
- {
- if (Package == "Normal")
- {
- packagePrice = 500;
- discount = 0.05;
- }
- else if (Package == "Gold")
- {
- packagePrice = 750;
- discount = 0.1;
- }
- else
- {
- packagePrice = 1000;
- discount = 0.15;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement