/
kanisavi
/
Course_exceptions
Обзор
Документация
Войти
/
kanisavi
/
Course_exceptions
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Main.java
30 строк
1 KB
Карина Басова
create Main.java
28 дек 2025, 14:34
28 дек 2025, 14:34
a4dfb75
Код
Авторство
О чём код?
import java.util.Scanner; public class Main { public static void main(String[] args) throws NumberFormatException { PasswordChecker passwordChecker = new PasswordChecker(); Scanner scanner = new Scanner(System.in); try { System.out.println("Введите мин. длину пароля: "); int minLength = Integer.parseInt(scanner.nextLine()); passwordChecker.setMinLength(minLength); System.out.println("Введите макс. допустимое количество повторений символа подряд: "); int maxRepeats = Integer.parseInt(scanner.nextLine()); passwordChecker.setMaxRepeats(maxRepeats); } catch (NumberFormatException exception) { throw new IllegalStateException("Недопустимые найстройки!"); } while (true) { System.out.print("Введите пароль или end: "); String input = scanner.nextLine(); if (input.equals("end")) { break; } if (passwordChecker.verify(input)) { System.out.println("Подходит!"); } else { System.out.println("Не подходит!"); } } } }