Stept 9 done

This commit is contained in:
2026-09-14 16:39:04 +09:00
parent b655390c6f
commit eacd21df50

View File

@@ -66,27 +66,36 @@ public class Main {
// System.out.println(employee.mailAddress);
// System.out.println(employee.password);
// System.out.println(employee.idDepartment);
Scanner scan = new Scanner(System.in);
while (true) {
System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
//stept 8
Scanner scan = new Scanner(System.in);
System.out.println("検索したい社員IDを入力してください");
//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)){
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();
}
}
}