1日目の8段階目終わりました
This commit is contained in:
@@ -1,6 +1,15 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
System.out.println("検索したい社員IDを入力してください");
|
||||||
|
String input = scanner.nextLine();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BaseData[] employees = new BaseData[5];
|
BaseData[] employees = new BaseData[5];
|
||||||
|
|
||||||
employees[0] = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
employees[0] = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
||||||
@@ -17,27 +26,46 @@ public class Main {
|
|||||||
//
|
//
|
||||||
// System.out.println("現在の社員データ件数:" + EmployeeData.getEmpCount() + "件");
|
// System.out.println("現在の社員データ件数:" + EmployeeData.getEmpCount() + "件");
|
||||||
|
|
||||||
String serchId1 = "10002";
|
|
||||||
System.out.println(serchId1 + "を検索します");
|
|
||||||
boolean bo = false;
|
|
||||||
for (int i = 0; i < employees.length; i++) {
|
|
||||||
if (((EmployeeData) employees[i]).isMatchId(serchId1)) {
|
|
||||||
bo = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
System.out.println(bo);
|
String serchId1 = "10002";
|
||||||
|
// System.out.println(serchId1 + "を検索します");
|
||||||
|
// boolean bo = false;
|
||||||
|
// for (int i = 0; i < employees.length; i++) {
|
||||||
|
// if (((EmployeeData) employees[i]).isMatchId(serchId1)) {
|
||||||
|
// bo = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// System.out.println(bo);
|
||||||
String serchId2 = "99999";
|
String serchId2 = "99999";
|
||||||
System.out.println(serchId2 + "を検索します");
|
// System.out.println(serchId2 + "を検索します");
|
||||||
boolean bl = false;
|
// boolean bl = false;
|
||||||
for (int i = 0; i < employees.length; i++) {
|
// for (int i = 0; i < employees.length; i++) {
|
||||||
if (((EmployeeData) employees[i]).isMatchId(serchId2)) {
|
// if (((EmployeeData) employees[i]).isMatchId(serchId2)) {
|
||||||
bl = true;
|
// bl = true;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// System.out.println(bl);
|
||||||
|
|
||||||
|
|
||||||
|
boolean a = false;
|
||||||
|
for(int i = 0; i < employees.length; i++) {
|
||||||
|
if (((EmployeeData) employees[i]).isMatchId(input)) {
|
||||||
|
a = true;
|
||||||
|
System.out.println(employees[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println(bl);
|
if (!a) {
|
||||||
|
System.out.println("該当する社員が見つかりませんでした");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BaseData employee = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
BaseData employee = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user