Day1_8段階目
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
|
||||
@@ -19,8 +20,8 @@ public class Main {
|
||||
Employees[0].setPassword("aaa");
|
||||
Employees[0].setIdDepartment("10");
|
||||
|
||||
System.out.println("10000を検索します");
|
||||
System.out.println(Employees[0].isMatchID("10000"));
|
||||
// System.out.println("10000を検索します");
|
||||
// System.out.println(Employees[0].isMatchID("10000"));
|
||||
|
||||
Employees[1].setIdEmployee("10001");
|
||||
Employees[1].setNmEmployee("高橋準");
|
||||
@@ -50,7 +51,24 @@ public class Main {
|
||||
Employees[4].setPassword("eee");
|
||||
Employees[4].setIdDepartment("13");
|
||||
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
System.out.println("検索したい社員IDを入力してください");
|
||||
String id = scanner.nextLine();
|
||||
boolean found = false;
|
||||
|
||||
for (int i = 0; i < Employees.length; i++) {
|
||||
|
||||
if(Employees[i].isMatchID(id)) {
|
||||
Employees[i].showInfo();
|
||||
found = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(found == false) {
|
||||
System.out.println("該当する社員が見つかりませんでした");
|
||||
}
|
||||
|
||||
// Employees[0].showInfo();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user