Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int choiceEntry = 0;
- Scanner scanner = new Scanner(System.in);
- while (true) {
- System.out.println("Меню:\n 1) Работать с датасетом \n 2) Выйти");
- while (true) {
- System.out.print("Сделайте выбор - ");
- String input = scanner.next();
- try {
- choiceEntry = Integer.parseInt(input);
- if (choiceEntry > 0 && choiceEntry < 3) {
- break;
- } else {
- System.out.println("Выбранный пункт меня отсутсвует");
- }
- } catch (NumberFormatException ne) {
- System.out.println("Это не число");
- }
- }
- switch (choiceEntry) {
- case 2 -> {
- System.exit(0);
- }
- case 1 -> {
- int amount = 0;
- System.out.print("Введите название файла = ");
- String fileName = scanner.next();
- System.out.print("Введите символ - разделитель = ");
- String separator= scanner.next();
- try {
- CsvReader reader = new CsvReader(fileName,separator);
- reader.tryToRead();
- System.out.println("Результаты обработки датасета:");
- ArrayList<PersonModel> result = reader.getResult();
- for (var person : result) {
- System.out.println(person.toString());
- }
- System.out.println("\n\n");
- } catch (Exception ex) {
- System.out.println(ex.getMessage());
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement