diff --git a/em-oop/src/Main.java b/em-oop/src/Main.java index 7d9685d..e98803a 100644 --- a/em-oop/src/Main.java +++ b/em-oop/src/Main.java @@ -66,27 +66,36 @@ public class Main { // System.out.println(employee.mailAddress); // System.out.println(employee.password); // System.out.println(employee.idDepartment); - - //stept 8 Scanner scan = new Scanner(System.in); - System.out.println("検索したい社員IDを入力してください"); - String serchId = scan.nextLine(); - - boolean found = false; //←if it haven't this boolean , they can't be decided true or false, so we should be make boolan name (found) - for (int i =0; i< employees.length; i++) { - if (employees[i].isMatchId(serchId)){ - employees[i].showInfo(); - found = true; + while (true) { + System.out.println("検索したい社員IDを入力してください(終了する場合は0)"); + + //stept 8 + + //System.out.println("検索したい社員IDを入力してください"); + String serchId = scan.nextLine(); + + if (serchId.equals("0")) { //stept 9 + System.out.println("システムを終了します"); break; } - + + boolean found = false; //←if it haven't this boolean , they can't be decided true or false, so we should be make boolan name (found) + for (int i = 0; i < employees.length; i++) { + if (employees[i].isMatchId(serchId)) { + employees[i].showInfo(); + found = true; + break; + } + } - if(!found) { + if (!found) { System.out.println("該当する社員が見つかりませんでした"); } - scan.close(); + } + scan.close(); + } - - +}