Day3、5段階目完了
This commit is contained in:
@@ -68,8 +68,12 @@ public class EmployeeData extends BaseData {
|
||||
//上記メソッドの書き換え
|
||||
@Override
|
||||
public String toString() {
|
||||
return idEmployee + " " + nmEmployee + " " + knEmployee + " " + mailAddress + " " + password + " "
|
||||
+ idDepartment;
|
||||
return getIdEmployee() + "\t"+
|
||||
getNmEmployee() + "\t"+
|
||||
getKnEmployee() + "\t"+
|
||||
getMailAddress() + "\t"+
|
||||
getPassword() + "\t"+
|
||||
getIdDepartment();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ public class Main {
|
||||
public static void main(String[] args) {
|
||||
// TODO 自動生成されたメソッド・スタブ
|
||||
//インスタンス宣言
|
||||
EmployeeData employee = new EmployeeData();
|
||||
BaseData employee = new EmployeeData();
|
||||
//配列5件分
|
||||
EmployeeData[] employees = new EmployeeData[5];
|
||||
BaseData[] employees = new BaseData[5];
|
||||
//5段階目書き換え
|
||||
employees[0] = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
||||
employees[1] = new EmployeeData("10001", "高橋準", "タカハシジュン", "jtaka@hoge.jp", "bbb", "10");
|
||||
@@ -32,18 +32,17 @@ public class Main {
|
||||
boolean result = false;
|
||||
//該当の場合
|
||||
for (int i = 0; i < employees.length; i++) {
|
||||
if (employees[i].isMatchID(id)) {
|
||||
if (employees[i].getPrimaryKeyValue().equals(id)) {
|
||||
result = true;
|
||||
employees[i].showInfo();
|
||||
System.out.println(employees[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (result == false) {
|
||||
System.out.println("該当する社員が見つかりませんでした");
|
||||
System.out.println("該当する社員が見つかりませんでした(終了する場合は0を入力)");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//for文
|
||||
//for (int i = 0; i < employees.length; i++) {
|
||||
@@ -52,3 +51,5 @@ public class Main {
|
||||
//System.out.println(employees[i].getPrimaryKeyValue());
|
||||
//employees[i].showInfo();を上記に書き換え
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user