1日目 9段階目 小澤

This commit is contained in:
2026-09-18 13:27:23 +09:00
parent c49e595ba5
commit a1b84b16f1

View File

@@ -42,22 +42,29 @@ public class Main {
Scanner sc = new Scanner(System.in); Scanner sc = new Scanner(System.in);
System.out.println("検索したい社員IDを入力してください");
String id = sc.nextLine();
boolean result = false;
for (int i = 0; i < employees.length; i++) { for (int i = 0; i < employees.length; i++) {
System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
String id = sc.nextLine();
boolean result = false;
if(id.equals("0")) {
System.out.println("システムを終了します");
break;
}
if (employees[i].isMatchId(id)) { if (employees[i].isMatchId(id)) {
result = true; result = true;
employees[i].showInfo(); employees[i].showInfo();
break;
}
} }
if(result==false) { if(result==false) {
System.out.println("該当する社員が見つかりませんでした"); System.out.println("該当する社員が見つかりませんでした");
} }
} }
}
// System.out.println("99999を検索します"); // System.out.println("99999を検索します");