Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- const string ShowCommandsCommand = "showCommands";
- const string TopUpBalanceCommand = "topUpBalance";
- const string OrderFoodCommand = "orderFood";
- const string CheckBalanceCommand = "checkBalance";
- const string ChangePassword = "changePassword";
- const string ClearConsoleCommand = "clearConsole";
- const string ExitCommand = "exit";
- string showCommands = "Показывает все доступные команды.";
- string topUpBalance = "Пополняет баланс пользователя.";
- string orderFood = "Заказывает доставку еды.";
- string checkBalance = "Выводит информацию о балансе пользователя.";
- string changePassword = "Меняет пароль пользователя.";
- string clearConsole = "Очищает консоль.";
- string exit = "Выход из программы";
- string textCommands = "Команды!!\n" +
- $"{ShowCommandsCommand} - {showCommands}\n" +
- $"{TopUpBalanceCommand} - {topUpBalance}\n" +
- $"{OrderFoodCommand} - {orderFood}\n" +
- $"{CheckBalanceCommand} - {checkBalance}\n" +
- $"{ChangePassword} - {changePassword}\n" +
- $"{ClearConsoleCommand} - {clearConsole}\n" +
- $"{ExitCommand} - {exit}";
- string userInput = "";
- int balance = 100;
- string password = "qwerty";
- int priceDelivery = 20;
- bool isRunning = true;
- Console.WriteLine(textCommands);
- while (isRunning == true)
- {
- Console.WriteLine("Введите команду: ");
- userInput = Console.ReadLine();
- switch (userInput)
- {
- case ShowCommandsCommand:
- Console.WriteLine(textCommands);
- break;
- case TopUpBalanceCommand:
- Console.WriteLine("Введите сумму");
- balance += Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Успешное пополние!!");
- break;
- case OrderFoodCommand:
- Console.WriteLine($"Ваш курьер в пути. ( - {priceDelivery}$)");
- balance -= priceDelivery;
- break;
- case CheckBalanceCommand:
- Console.WriteLine($"Ваш баланc - {balance}$");
- break;
- case ChangePassword:
- userInput = Console.ReadLine();
- if (userInput == password)
- {
- Console.WriteLine("Введите новый пароль");
- password = Console.ReadLine();
- }
- else
- {
- Console.WriteLine("Неверный пароль!!");
- }
- break;
- case ClearConsoleCommand:
- Console.Clear();
- break;
- case ExitCommand:
- isRunning = false;
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement