Advertisement
Guest User

3.1

a guest
Aug 20th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.39 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CSLight11
  4. {
  5. internal class Program
  6. {
  7. private static void Main(string[] args)
  8. {
  9. int[] bron = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  10. int moneyvisitor = 25;
  11. int moneyowner = 300;
  12. bool choiceon = true;
  13. string choice = "kek";
  14. int i = 0;
  15. int[] table = { 2, 2, 2, 2, 2, 2 };
  16. while (true)
  17. {
  18. if (choiceon == true)
  19. {
  20. Console.WriteLine("Выберите полномочия");
  21. Console.WriteLine("1. Владелец");
  22. Console.WriteLine("2. Посетитель");
  23. Console.Write("Введите цифру для выбора: ");
  24. choice = Console.ReadLine();
  25. }
  26. if (choice == "1")
  27. {
  28. for (i = 0; i < table.Length; i++)
  29. {
  30. Console.WriteLine("Стол номер " + (i + 1) + " - " + table[i] + " | " + bron[i] + " Забронировано.");
  31. }
  32. choiceon = false;
  33. Console.WriteLine("Ваш счёт " + moneyowner);
  34. Console.WriteLine("1. Расширить стол (1 доп. место стоит 10; Максимум 4 места за одним столом.)");
  35. Console.WriteLine("2. Увеличить кол-во столов (Минимальная стоимость 10; Максимум 12 столов.)");
  36. Console.WriteLine("3. Вернуться в меню.");
  37. string choice1 = Console.ReadLine();
  38. if (choice1 == "1")
  39. {
  40. Console.WriteLine("Какой стол хотите расширить.");
  41. int tablechoice1 = Convert.ToInt32(Console.ReadLine()) - 1;
  42. Console.WriteLine("Сколько мест хотите докупить.");
  43. int tablechoice2 = Convert.ToInt32(Console.ReadLine());
  44. if (tablechoice2 > 0 && tablechoice2 + table[tablechoice1] + bron[tablechoice1] <= 4 && tablechoice1 > -1 && tablechoice1 <= table.Length && tablechoice2 * 10 <= moneyowner )
  45. {
  46. moneyowner -= tablechoice2 * 10;
  47. table[tablechoice1] = tablechoice2 + table[tablechoice1];
  48. Console.Clear();
  49. }
  50. else
  51. {
  52. Console.WriteLine("Некоректный ввод");
  53. }
  54. }
  55. if (choice1 == "2")
  56. {
  57. Console.WriteLine("Сколько столов хотите купить. Возможное количество: " + (12 - table.Length));
  58. int buychoice1 = Convert.ToInt32(Console.ReadLine());
  59. Console.WriteLine("Какие столы хотите купить: 2. Малый (2 места): 20, 3. Средний (3 места): 30, 4. Высокий (4 места): 40");
  60. int buychoice2 = Convert.ToInt32(Console.ReadLine());
  61. Console.Clear();
  62. if (buychoice1 + table.Length <= 12 && moneyowner >= buychoice1 * 10)
  63. {
  64. moneyowner -= buychoice1 * 10 * buychoice2;
  65. int[] kek = new int[table.Length + buychoice1];
  66. for (i = 0; i < table.Length; i++)
  67. {
  68. kek[i] = table[i];
  69. }
  70. while (i <= kek.Length)
  71. {
  72. kek[i - 1] = buychoice2;
  73. i++;
  74. }
  75. table = kek;
  76. }
  77. }
  78. if (choice1 == "3")
  79. {
  80. choiceon = true;
  81. continue;
  82. }
  83. }
  84. if (choice == "2")
  85. {
  86. choiceon = false;
  87. Console.WriteLine("Программа бронирования столов.\n \n");
  88. Console.WriteLine("Ваши финансы " + moneyvisitor);
  89. Console.WriteLine("Введите 228 для выхода в меню.");
  90. for (i = 0; i < table.Length; i++)
  91. {
  92. Console.WriteLine("Стол номер " + (i + 1) + " - " + table[i] + " | " + bron[i] + " Забронировано.");
  93.  
  94.  
  95. }
  96. Console.Write("\n\nВведите номер стола:");
  97. int tableNum = Convert.ToInt32(Console.ReadLine()) - 1;
  98. if (tableNum == 227)
  99. {
  100. choiceon = true;
  101. continue;
  102. }
  103. Console.Write("Введите количество мест:");
  104. int placeCount = Convert.ToInt32(Console.ReadLine());
  105. if (placeCount == 228)
  106. {
  107. choiceon = true;
  108. continue;
  109. }
  110. if (table.Length > tableNum && tableNum >= 0)
  111. {
  112. if (table[tableNum] < placeCount)
  113. {
  114. Console.WriteLine("Недостаточно мест за столом.");
  115. }
  116. else
  117. {
  118. if (placeCount > 0 && moneyvisitor >= 5 * placeCount)
  119. {
  120. bron[tableNum] += placeCount;
  121. moneyvisitor -= placeCount * 5;
  122. moneyowner += placeCount * 5;
  123. table[tableNum] -= placeCount;
  124. Console.WriteLine("\nМесто забронировано, а деньги поступили владельцу на счёт.");
  125. Console.WriteLine(" Нажмите любую клавишу для продолжения...");
  126. }
  127. else
  128. {
  129. Console.WriteLine("Некорректный ввод мест либо не хватает денег. Нажмите любую клавишу для продолжения...");
  130. }
  131. }
  132. }
  133. else
  134. {
  135. Console.WriteLine("Несуществующий стол. Нажмите любую клавишу для продолжения");
  136. }
  137.  
  138. Console.ReadKey();
  139. Console.Clear();
  140. }
  141. }
  142.  
  143.  
  144.  
  145.  
  146. }
  147. }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement