Day2、6段階目完了
This commit is contained in:
@@ -57,13 +57,20 @@ public class EmployeeData {
|
||||
}
|
||||
|
||||
//メソッド追加
|
||||
void showInfo() {
|
||||
System.out.println(getIdEmployee());
|
||||
System.out.println(getNmEmployee());
|
||||
System.out.println(getKnEmployee());
|
||||
System.out.println(getMailAddress());
|
||||
System.out.println(getPassword());
|
||||
System.out.println(getIdDepartment());
|
||||
// void showInfo() {
|
||||
// System.out.println(getIdEmployee());
|
||||
// System.out.println(getNmEmployee());
|
||||
// System.out.println(getKnEmployee());
|
||||
// System.out.println(getMailAddress());
|
||||
// System.out.println(getPassword());
|
||||
// System.out.println(getIdDepartment());
|
||||
// }
|
||||
|
||||
//上記メソッドの書き換え
|
||||
@Override
|
||||
public String toString() {
|
||||
return idEmployee + " " + nmEmployee + " " + knEmployee + " " + mailAddress + " " + password + " " + idDepartment ;
|
||||
|
||||
}
|
||||
|
||||
//コンストラクタ追加(引数なし)
|
||||
|
||||
@@ -44,12 +44,14 @@ public class Main {
|
||||
// employees[4].setMailAddress("miya@hoge.jp");
|
||||
// employees[4].setPassword("eee");
|
||||
// employees[4].setIdDepartment("13");
|
||||
|
||||
//5段階目書き換え
|
||||
employees[0] = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
|
||||
employees[1] = new EmployeeData("10001", "高橋準", "タカハシジュン", "jtaka@hoge.jp", "bbb", "10");
|
||||
employees[2] = new EmployeeData("10002", "麻枝文明", "マエダフミアキ", "fmak@hoge.jp", "ccc", "11");
|
||||
employees[3] = new EmployeeData("10003","丸戸章介","マルトショウスケ","marusyo@hoge.jp","ddd","12");
|
||||
employees[4] = new EmployeeData("10004","三宅武","ミヤケタケシ","miya@hoge.jp","eee","13");
|
||||
employees[3] = new EmployeeData("10003", "丸戸章介", "マルトショウスケ", "marusyo@hoge.jp", "ddd", "12");
|
||||
employees[4] = new EmployeeData("10004", "三宅武", "ミヤケタケシ", "miya@hoge.jp", "eee", "13");
|
||||
|
||||
//各フィールド代入
|
||||
//employee.idEmployee = "10000";
|
||||
//employee.nmEmployee = "山田龍也";
|
||||
@@ -71,7 +73,8 @@ public class Main {
|
||||
|
||||
//for文
|
||||
for (int i = 0; i < employees.length; i++) {
|
||||
employees[i].showInfo();
|
||||
System.out.println(employees[i]);
|
||||
//employees[i].showInfo();を上記に書き換え
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user