@@ -24,13 +24,12 @@ public void run(){
2424 case 1 -> printFillingDatabaseMenu ();
2525 case 2 -> printSortingMenu ();
2626 case 0 -> exitByChoice ();
27- default -> System .out .println ("Неверный выбор. Пожалуйста, выберите 1, 2 или 3 " );
27+ default -> System .out .println ("Неверный выбор. Пожалуйста, выберите 1, 2 или 0 " );
2828 }
2929 } catch (Exception e ){
3030 System .out .println ("Ошибка: " + e .getMessage ());
3131 System .out .println ("Пожалуйста, введите корректный номер опции." );
3232 }
33- scanner .close ();
3433 }
3534 }
3635
@@ -87,7 +86,7 @@ public void printSortingMenu() {
8786 System .out .println ("Возврат в главное меню..." );
8887 backToMain = true ;
8988 }
90- default -> System .out .println ("Неверный выбор. Пожалуйста, выберите от 1 до 5 " );
89+ default -> System .out .println ("Неверный выбор. Пожалуйста, выберите от 0 до 4 " );
9190 }
9291 } catch (NumberFormatException e ){
9392 System .out .println ("Пожалуйста, введите цифру для выбора действия." );
@@ -118,7 +117,7 @@ public void printNameSortingOptions() {
118117 System .out .println ("Назад..." );
119118 backToMain = true ;
120119 }
121- default -> System .out .println ("Неверный выбор. Пожалуйста, выберите от 1 до 5 " );
120+ default -> System .out .println ("Неверный выбор. Пожалуйста, выберите от 0 до 3 " );
122121 }
123122 } catch (NumberFormatException e ){
124123 System .out .println ("Пожалуйста, введите цифру для выбора действия." );
@@ -149,7 +148,7 @@ public void printIdSortingOptions() {
149148 System .out .println ("Назад..." );
150149 backToMain = true ;
151150 }
152- default -> System .out .println ("Неверный выбор. Пожалуйста, выберите от 1 до 5 " );
151+ default -> System .out .println ("Неверный выбор. Пожалуйста, выберите от 0 до 3 " );
153152 }
154153 } catch (NumberFormatException e ){
155154 System .out .println ("Пожалуйста, введите цифру для выбора действия." );
@@ -180,7 +179,7 @@ public void printPhoneSortingOptions() {
180179 System .out .println ("Назад..." );
181180 backToMain = true ;
182181 }
183- default -> System .out .println ("Неверный выбор. Пожалуйста, выберите от 1 до 5 " );
182+ default -> System .out .println ("Неверный выбор. Пожалуйста, выберите от 0 до 3 " );
184183 }
185184 } catch (NumberFormatException e ){
186185 System .out .println ("Пожалуйста, введите цифру для выбора действия." );
@@ -227,7 +226,6 @@ private void sortPhoneByOperatorCode(){
227226 private void fillManually (){
228227 System .out .println ("Выбран способ ввода данных вручную" );
229228 System .out .println ("Введите данные..." );
230- scanner .nextLine ();
231229 System .out .println ("Данные успешно сохранены" );
232230
233231 }
@@ -253,6 +251,7 @@ private void printDefaultOrder(){
253251 private void exitByChoice (){
254252 System .out .println ("Выход из программы..." );
255253 running = false ;
254+ scanner .close ();
256255 }
257256
258257 private int inputLengthOfValue (String prompt , int defaultValue ){
0 commit comments