8段階目(社員をID検索してみよう)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@@ -88,6 +89,21 @@ public class Main {
|
|||||||
System.out.println("10003 を検索します");
|
System.out.println("10003 を検索します");
|
||||||
System.out.println(EmployeeData.isMatchId(employees, "10003"));
|
System.out.println(EmployeeData.isMatchId(employees, "10003"));
|
||||||
|
|
||||||
|
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);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("該当する社員が見つかりませんでした");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user