Skip to content

Instantly share code, notes, and snippets.

@JJack55on
Created April 24, 2025 10:49
Show Gist options
  • Save JJack55on/dcdd3e03ae9e8b9b486df33184c664ac to your computer and use it in GitHub Desktop.
Save JJack55on/dcdd3e03ae9e8b9b486df33184c664ac to your computer and use it in GitHub Desktop.
using System.Drawing;
using System.Security.Cryptography.X509Certificates;
using System.Xml.Linq;
using static System.Runtime.InteropServices.JavaScript.JSType;
// Меню кебабов (шаверма, мини, дёнер, на тарелке)
// Выбор вида кебаба в соответсвии с предпочтениямии по начинке
public class Program
{
public class Kebab
{
public const string Bread = "pita";
public string Name { get; set; }
public string Meat { get; set; }
public string Sauce { get; set; }
public string Size { get; set; }
private string Spiciness { get; set; }
public int Date { get; set; } // Дата изготовления
public int ExpirationDate { get; set; } // Срок годности
public int StorageTemperature { get; set; } // Температура хранения
public Kebab(string name, string sauce, string meat, string size, string spiciness, int date, int expirationDate, int storageTemperature)
{
Name = name;
Sauce = sauce;
Meat = meat;
Size = size;
Spiciness = spiciness;
Date = date;
ExpirationDate = expirationDate;
StorageTemperature = storageTemperature;
}
public virtual bool IsFresh()
{
return Date <= ExpirationDate && StorageTemperature <= 10;
}
public virtual bool IsAvailable()
{
return Meat != null && Sauce != null;
}
public virtual string GetInfo()
{
return $"Название: {Name}, Мясо: {Meat}, Соус: {Sauce}, Размер: {Size}, Острота: {Spiciness}, Годен до: {Date+ExpirationDate}";
}
}
public class Shwarma : Kebab
{
public Shwarma(string name, string sauce, string meat, string size, string spiciness, int date, int expirationDate, int storageTemperature)
: base(name, sauce, meat, size, spiciness, date, expirationDate, storageTemperature)
{
Name = "Shwarma";
Sauce = "Classic";
Meat = "Chiken";
Size = "M";
spiciness = "_spicy";
Date = 24;
ExpirationDate = 1;
StorageTemperature = 15;
}
public override bool IsAvailable()
{
return Meat != null && Sauce != null;
}
public override bool IsFresh()
{
return Date <= ExpirationDate && StorageTemperature <= 8;
}
public string GetInfo(string spiciness)
{
return $"Название: {Name}, Мясо: {Meat}, Соус: {Sauce}, Размер: {Size}, Острота: {spiciness}, Годен до: {Date + ExpirationDate}";
}
}
public sealed class MiniSwarma : Shwarma
{
public MiniSwarma(string name, string sauce, string meat, string size, string spiciness, int date, int expirationDate, int storageTemperature)
: base(name, sauce, meat, size, spiciness, date, expirationDate, storageTemperature)
{
Name = "MiniSwarma";
Meat = "Chiken";
Sauce = "Classic";
Size = "S";
spiciness = "_nonSpicy";
Date = 24;
ExpirationDate = 4;
StorageTemperature = 12;
}
public override bool IsAvailable()
{
return Meat != null && Sauce != null;
}
public override bool IsFresh()
{
return Date <= ExpirationDate && StorageTemperature <= 8;
}
public string GetInfo(string spiciness)
{
return $"Название: {Name}, Мясо: {Meat}, Соус: {Sauce}, Размер: {Size}, Острота: {spiciness}, Годен до: {Date + ExpirationDate}";
}
}
public sealed class DonerKebab : Kebab
{
public DonerKebab(string Beef, string name, string sauce, string meat, string size, string spiciness, int date, int expirationDate, int storageTemperature)
: base(name, sauce, meat, size, spiciness, date, expirationDate, storageTemperature)
{
Name = "DonerKebab";
Beef = null;
Meat = Beef;
if (Meat == Beef)
{
Meat = null;
return;
}
Sauce = "Salsa";
Size = "L";
spiciness = "_hot";
Date = 21;
ExpirationDate = 1;
StorageTemperature = 14;
}
public override bool IsAvailable()
{
return Meat != null && Sauce != null;
}
public override bool IsFresh()
{
return Date <= ExpirationDate && StorageTemperature <= 12;
}
public string GetInfo(string spiciness)
{
return $"Название: {Name}, Мясо: {Meat}, Соус: {Sauce}, Размер: {Size}, Острота: {spiciness}, Годен до: {Date + ExpirationDate}";
}
}
public sealed class KebabPlate : Kebab
{
public KebabPlate(string Chicken, string Beef, string name, string sauce, string meat, string size, string spiciness, int date, int expirationDate, int storageTemperature)
: base(name, sauce, meat, size, spiciness, date, expirationDate, storageTemperature)
{
Name = "KebabPlate";
Chicken = "Chiken";
Beef = null;
if (Meat == Beef)
{
Meat = Chicken;
return;
}
Sauce = "Classic and Salsa";
Size = "XL";
spiciness = "_hot";
Date = 23;
ExpirationDate = 25;
StorageTemperature = 10;
}
public override bool IsAvailable()
{
return Meat != null && Sauce != null;
}
public override bool IsFresh()
{
return Date <= ExpirationDate && StorageTemperature <= 10;
}
public string GetInfo(string spiciness)
{
return $"Название: {Name}, Мясо: {Meat}, Соус: {Sauce}, Размер: {Size}, Острота: {spiciness}, Годен до: {Date + ExpirationDate}";
}
}
public enum KebabType
{
InPita, OnPlate
}
public static KebabType GetKebabType()
{
Console.WriteLine("Выберите тип кебаба (в пите или на тарелке):");
while (true)
{
string input = Console.ReadLine();
if (input == "в пите")
{
return KebabType.InPita;
}
else if (input == "на тарелке")
{
return KebabType.OnPlate;
}
}
}
public void Main(string[] args)
{
KebabType selectedType = GetKebabType();
Console.WriteLine($"Выбрали тип кебаба:{selectedType}");
if (selectedType == KebabType.InPita)
{
Console.WriteLine("в пите");
}
else
{
Console.WriteLine("на тарелке");
}
MiniSwarma mini = new MiniSwarma("Mini", "Classic", "Chicken", "S", "nonSpicy", 24, 2, 8);
Console.WriteLine($"{mini.GetInfo()}");
Console.WriteLine($"В наличии:{mini.IsAvailable()}");
if (!mini.IsFresh())
{
Console.WriteLine("Просроченный продукт");
}
Console.WriteLine();
Shwarma standart = new Shwarma("Standart", "Classic", "Chicken", "M", "Spicy", 24, 4, 10);
Console.WriteLine($"{standart.GetInfo()}");
Console.WriteLine($"В наличии:{standart.IsAvailable()}");
if (!standart.IsFresh())
{
Console.WriteLine("Просроченный продукт");
}
Console.WriteLine();
DonerKebab istambul = new DonerKebab("Beef", "Istambul", "Salsa", null, "L", "Hot", 21, 1, 13);
Console.WriteLine($"{istambul.GetInfo()}");
if (!istambul.IsAvailable())
{
Console.WriteLine("Отсутствует");
}
Console.WriteLine();
if (!istambul.IsFresh())
{
Console.WriteLine("Просроченный продукт");
}
Console.WriteLine();
KebabPlate iskander = new KebabPlate("Chicken", null, "Iskander", "classicAndSalsa", " ", "XL", "Hot", 24, 25, 10);
Console.WriteLine($"{iskander.GetInfo()}");
Console.WriteLine($"В наличии:{iskander.IsAvailable()}");
if (!iskander.IsFresh())
{
Console.WriteLine("Просроченный продукт");
}
Console.WriteLine();
}
}

Comments are disabled for this gist.