Day1、9段階目完了
This commit is contained in:
@@ -19,12 +19,18 @@ public class Main {
|
||||
//employee.showInfo();
|
||||
|
||||
//Day1、8段階目検索
|
||||
while (true) {
|
||||
Scanner sc = new Scanner(System.in);//インスタンス化
|
||||
System.out.println("検索したい社員IDを入力してください");
|
||||
System.out.println("検索したい社員IDを入力してください(終了する場合は0を入力)");
|
||||
String id = sc.next();
|
||||
|
||||
if (id.equals("0")) {
|
||||
System.out.println("システムを終了します");
|
||||
break;
|
||||
}
|
||||
//boolean変数作成
|
||||
boolean result = false;
|
||||
|
||||
//該当の場合
|
||||
for (int i = 0; i < employees.length; i++) {
|
||||
if (employees[i].isMatchID(id)) {
|
||||
result = true;
|
||||
@@ -35,6 +41,8 @@ public class Main {
|
||||
if (result == false) {
|
||||
System.out.println("該当する社員が見つかりませんでした");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//for文
|
||||
|
||||
Reference in New Issue
Block a user