Skip to content

Commit 22fbb23

Browse files
committed
Дополнил логику методов.
1 parent f76039c commit 22fbb23

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

src/main/java/userInterface/MenuManager.java

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public void printSortingMenu() {
5656

5757
switch (fillSortOption){
5858
case 1 -> printDefaultOrder();
59-
case 2 -> printSortOfName();
60-
case 3 -> printSortOfID();
61-
case 4 -> printSortOfPhoneNumber();
59+
case 2 -> printNameSortingOptions();
60+
case 3 -> printIdSortingOptions();
61+
case 4 -> printPhoneSortingOptions();
6262
case 5 -> System.out.println("Возврат в главное меню...");
6363
}
6464
} catch (NumberFormatException e){
@@ -85,29 +85,38 @@ public void printPhoneSortingOptions() {
8585
}
8686
private void fillManually(){
8787
System.out.println("Выбран способ ввода данных вручную");
88+
System.out.println("Введите данные...");
89+
String input = scanner.nextLine().trim();
90+
System.out.println("Данные успешно сохранены");
91+
8892
}
8993

9094
private void fillFromFile(){
91-
System.out.println("Выбран способ ввода данных из файла");
95+
System.out.println("Выбран способ ввода данных из файла\n");
96+
System.out.println("Введите путь к файлу: ");
97+
String filePath = scanner.nextLine().trim();
98+
System.out.println("Загрузка из файла: " + filePath);
99+
92100
}
93101

94102
private void fillRandom(){
95103
System.out.println("Выбран способ ввода случайных данных");
104+
System.out.println("Сколько записей создать? ");
105+
String input = scanner.nextLine().trim();
106+
try {
107+
int count = Integer.parseInt(input);
108+
if (count > 0) {
109+
System.out.println("Будет создано " + count + "Случайных записей");
110+
}
111+
else {
112+
System.out.println("Должна быть как минимум одна запись!");
113+
}
114+
} catch (NumberFormatException e){
115+
System.out.println("Пожалуйста, введите количество записей");
116+
}
96117
}
97118

98119
private void printDefaultOrder(){
99120
System.out.println("Список клиентов");
100121
}
101-
102-
private void printSortOfName(){
103-
System.out.println("Сортировка по Имени");
104-
}
105-
106-
private void printSortOfID(){
107-
System.out.println("Сортировка по ID");
108-
}
109-
110-
private void printSortOfPhoneNumber(){
111-
System.out.println("Сортировка по номеру телефона");
112-
}
113122
}

0 commit comments

Comments
 (0)