9段階目(何度でも検索できるようにしよう)
This commit is contained in:
@@ -91,18 +91,30 @@ public class Main {
|
|||||||
|
|
||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
System.out.println("検索したい社員IDを入力してください");
|
|
||||||
System.out.println("(5桁の数字)");
|
|
||||||
System.out.print(">>>>");
|
|
||||||
Scanner scanner = new Scanner(System.in);
|
Scanner scanner = new Scanner(System.in);
|
||||||
String findId = scanner.nextLine();
|
while (true) {
|
||||||
for (EmployeeData e : employees) {
|
System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
|
||||||
if (e.isMatchId(findId)) {
|
System.out.print(">>>>");
|
||||||
System.out.println(e);
|
String findId = scanner.nextLine();
|
||||||
|
if (findId.equals("0")) {
|
||||||
|
System.out.println("システムを終了します");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean matchFlag = false;
|
||||||
|
|
||||||
|
for (EmployeeData e : employees) {
|
||||||
|
if (e.isMatchId(findId)) {
|
||||||
|
System.out.println(e);
|
||||||
|
matchFlag = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!matchFlag) {
|
||||||
|
System.out.println("該当する社員が見つかりませんでした");
|
||||||
|
}
|
||||||
|
System.out.println();
|
||||||
}
|
}
|
||||||
System.out.println("該当する社員が見つかりませんでした");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user