Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight11
- {
- internal class Program
- {
- private static void Main(string[] args)
- {
- int[] bron = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- int moneyvisitor = 25;
- int moneyowner = 300;
- bool choiceon = true;
- string choice = "kek";
- int i = 0;
- int[] table = { 2, 2, 2, 2, 2, 2 };
- while (true)
- {
- if (choiceon == true)
- {
- Console.WriteLine("Выберите полномочия");
- Console.WriteLine("1. Владелец");
- Console.WriteLine("2. Посетитель");
- Console.Write("Введите цифру для выбора: ");
- choice = Console.ReadLine();
- }
- if (choice == "1")
- {
- for (i = 0; i < table.Length; i++)
- {
- Console.WriteLine("Стол номер " + (i + 1) + " - " + table[i] + " | " + bron[i] + " Забронировано.");
- }
- choiceon = false;
- Console.WriteLine("Ваш счёт " + moneyowner);
- Console.WriteLine("1. Расширить стол (1 доп. место стоит 10; Максимум 4 места за одним столом.)");
- Console.WriteLine("2. Увеличить кол-во столов (Минимальная стоимость 10; Максимум 12 столов.)");
- Console.WriteLine("3. Вернуться в меню.");
- string choice1 = Console.ReadLine();
- if (choice1 == "1")
- {
- Console.WriteLine("Какой стол хотите расширить.");
- int tablechoice1 = Convert.ToInt32(Console.ReadLine()) - 1;
- Console.WriteLine("Сколько мест хотите докупить.");
- int tablechoice2 = Convert.ToInt32(Console.ReadLine());
- if (tablechoice2 > 0 && tablechoice2 + table[tablechoice1] + bron[tablechoice1] <= 4 && tablechoice1 > -1 && tablechoice1 <= table.Length && tablechoice2 * 10 <= moneyowner )
- {
- moneyowner -= tablechoice2 * 10;
- table[tablechoice1] = tablechoice2 + table[tablechoice1];
- Console.Clear();
- }
- else
- {
- Console.WriteLine("Некоректный ввод");
- }
- }
- if (choice1 == "2")
- {
- Console.WriteLine("Сколько столов хотите купить. Возможное количество: " + (12 - table.Length));
- int buychoice1 = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Какие столы хотите купить: 2. Малый (2 места): 20, 3. Средний (3 места): 30, 4. Высокий (4 места): 40");
- int buychoice2 = Convert.ToInt32(Console.ReadLine());
- Console.Clear();
- if (buychoice1 + table.Length <= 12 && moneyowner >= buychoice1 * 10)
- {
- moneyowner -= buychoice1 * 10 * buychoice2;
- int[] kek = new int[table.Length + buychoice1];
- for (i = 0; i < table.Length; i++)
- {
- kek[i] = table[i];
- }
- while (i <= kek.Length)
- {
- kek[i - 1] = buychoice2;
- i++;
- }
- table = kek;
- }
- }
- if (choice1 == "3")
- {
- choiceon = true;
- continue;
- }
- }
- if (choice == "2")
- {
- choiceon = false;
- Console.WriteLine("Программа бронирования столов.\n \n");
- Console.WriteLine("Ваши финансы " + moneyvisitor);
- Console.WriteLine("Введите 228 для выхода в меню.");
- for (i = 0; i < table.Length; i++)
- {
- Console.WriteLine("Стол номер " + (i + 1) + " - " + table[i] + " | " + bron[i] + " Забронировано.");
- }
- Console.Write("\n\nВведите номер стола:");
- int tableNum = Convert.ToInt32(Console.ReadLine()) - 1;
- if (tableNum == 227)
- {
- choiceon = true;
- continue;
- }
- Console.Write("Введите количество мест:");
- int placeCount = Convert.ToInt32(Console.ReadLine());
- if (placeCount == 228)
- {
- choiceon = true;
- continue;
- }
- if (table.Length > tableNum && tableNum >= 0)
- {
- if (table[tableNum] < placeCount)
- {
- Console.WriteLine("Недостаточно мест за столом.");
- }
- else
- {
- if (placeCount > 0 && moneyvisitor >= 5 * placeCount)
- {
- bron[tableNum] += placeCount;
- moneyvisitor -= placeCount * 5;
- moneyowner += placeCount * 5;
- table[tableNum] -= placeCount;
- Console.WriteLine("\nМесто забронировано, а деньги поступили владельцу на счёт.");
- Console.WriteLine(" Нажмите любую клавишу для продолжения...");
- }
- else
- {
- Console.WriteLine("Некорректный ввод мест либо не хватает денег. Нажмите любую клавишу для продолжения...");
- }
- }
- }
- else
- {
- Console.WriteLine("Несуществующий стол. Нажмите любую клавишу для продолжения");
- }
- Console.ReadKey();
- Console.Clear();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement