Beispiel #1
0
 static void ShowInsertMoneyMenu(User user, Machine vendingMachine)
 {
     Console.Clear();
     Console.WriteLine("Введите сумму, которую хотите ввести:");
     int amount;
     if ((!int.TryParse(Console.ReadLine(), out amount)))
     {
         Console.WriteLine("Введены некоректные данные.\nДля повторения ввода нажмите любую клавишу.\n");
         Console.ReadKey();
         ShowInsertMoneyMenu(user, vendingMachine);
     }
     try {
         user.InsertMoney(vendingMachine, amount);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         Console.WriteLine("Для перехода в главное меню, нажмите любую клавишу");
         Console.ReadKey();
     }
 }