一日目段階8完了しました
This commit is contained in:
@@ -107,7 +107,7 @@ public class EmployeeData extends BaseDate {
|
|||||||
return idEmployee;
|
return idEmployee;
|
||||||
}
|
}
|
||||||
public boolean isMatchId(String id) {
|
public boolean isMatchId(String id) {
|
||||||
System.out.println(id + "を検索します");
|
// System.out.println(id + "を検索します");
|
||||||
if(id.equals(idEmployee)) {
|
if(id.equals(idEmployee)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,29 +1,37 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
EmployeeData[] employee = new EmployeeData[5];
|
EmployeeData[] employee = new EmployeeData[5];
|
||||||
|
|
||||||
employee[0] = new EmployeeData("10000","山田","ヤマダタツヤ","yamada@hoge.jp","aaa","10");
|
employee[0] = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
||||||
employee[1] = new EmployeeData("10001","高橋準","タカハシジュン","jtaka@hoge.jp","bbb","11");
|
employee[1] = new EmployeeData("10001", "高橋準", "タカハシジュン", "jtaka@hoge.jp", "bbb", "11");
|
||||||
employee[2] = new EmployeeData("10002","麻枝史明","マエダフミアキ","fmak@hoge.jp","ccc","12");
|
employee[2] = new EmployeeData("10002", "麻枝史明", "マエダフミアキ", "fmak@hoge.jp", "ccc", "12");
|
||||||
employee[3] = new EmployeeData("10003","丸戸章介","マルトショウスケ","marusyo@hoge.jp","ddd","13");
|
employee[3] = new EmployeeData("10003", "丸戸章介", "マルトショウスケ", "marusyo@hoge.jp", "ddd", "13");
|
||||||
employee[4] = new EmployeeData("10004","三宅武","ミヤケタケシ","miya@hoge.jp","eee","14");
|
employee[4] = new EmployeeData("10004", "三宅武", "ミヤケタケシ", "miya@hoge.jp", "eee", "14");
|
||||||
|
|
||||||
|
// for (int i=0; i<=4; i++ ) {
|
||||||
// for (int i=0; i<=4; i++ ) {
|
// System.out.println(employee[i]);
|
||||||
// System.out.println(employee[i]);
|
// }
|
||||||
// }
|
// int i=EmployeeData.getEmpCount();
|
||||||
// int i=EmployeeData.getEmpCount();
|
// System.out.println("現在の社員データ件数;"+ i + "件");
|
||||||
// System.out.println("現在の社員データ件数;"+ i + "件");
|
//
|
||||||
//
|
// System.out.println(employee[0].toCSV());
|
||||||
// System.out.println(employee[0].toCSV());
|
// System.out.println(employee[0].getPrimaryKeyValue());
|
||||||
// System.out.println(employee[0].getPrimaryKeyValue());
|
System.out.println("検索したい社員IDを入力してください");
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
boolean bo= employee[0].isMatchId("10000");
|
String str = sc.nextLine();
|
||||||
System.out.println(bo);
|
for (int i = 0; i <= 4; i++) {
|
||||||
|
boolean bo = employee[i].isMatchId(str);
|
||||||
|
if (bo == true) {
|
||||||
|
System.out.println(employee[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (bo == false && i == 4) {
|
||||||
|
System.out.println("該当する社員が見つかりませんでした");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user