9段階目(何度でも検索できるようにしよう)
This commit is contained in:
@@ -91,18 +91,30 @@ public class Main {
|
||||
|
||||
System.out.println();
|
||||
|
||||
System.out.println("検索したい社員IDを入力してください");
|
||||
System.out.println("(5桁の数字)");
|
||||
System.out.print(">>>>");
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
String findId = scanner.nextLine();
|
||||
for (EmployeeData e : employees) {
|
||||
if (e.isMatchId(findId)) {
|
||||
System.out.println(e);
|
||||
while (true) {
|
||||
System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
|
||||
System.out.print(">>>>");
|
||||
String findId = scanner.nextLine();
|
||||
if (findId.equals("0")) {
|
||||
System.out.println("システムを終了します");
|
||||
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