10/15作業分
This commit is contained in:
@@ -1,38 +1,118 @@
|
||||
package misson1014;
|
||||
|
||||
public class EmployeeData {
|
||||
//社員ID
|
||||
String idEmployee;
|
||||
//社員名
|
||||
String nmEmployee;
|
||||
//カナ
|
||||
String knEmployee;
|
||||
//メールアドレス
|
||||
String mailAddress;
|
||||
//PW
|
||||
String password;
|
||||
//部署ID
|
||||
String idDepartment;
|
||||
//社員ID
|
||||
private String idEmployee;
|
||||
//社員名
|
||||
private String nmEmployee;
|
||||
//社員名カナ
|
||||
private String knEmployee;
|
||||
//メールアドレス
|
||||
private String mailAddress;
|
||||
//パスワード
|
||||
private String password;
|
||||
//部署ID
|
||||
private String idDepartment;
|
||||
//社員データ件数
|
||||
private static int empCount = 0;
|
||||
//コンストラクタ
|
||||
public EmployeeData() {
|
||||
empCount++;
|
||||
}
|
||||
//コンストラクタ
|
||||
public EmployeeData(
|
||||
String idEmployee,
|
||||
String nmEmployee,
|
||||
String knEmployee,
|
||||
String mailAddress,
|
||||
String password,
|
||||
String idDepartment) {
|
||||
|
||||
this.setIdEmployee(idEmployee);
|
||||
this.setNmEmployee(nmEmployee);
|
||||
this.setKnEmployee(knEmployee);
|
||||
this.setMailAddress(mailAddress);
|
||||
this.setPassword(password);
|
||||
this.setIdDepartment(idDepartment);
|
||||
empCount++;
|
||||
|
||||
}
|
||||
//ゲッター
|
||||
public String getIdEmployee() {
|
||||
return idEmployee;
|
||||
}
|
||||
public String getNmEmployee() {
|
||||
return nmEmployee;
|
||||
}
|
||||
public String getKnEmployee() {
|
||||
return knEmployee;
|
||||
}
|
||||
public String getMailAddress() {
|
||||
return mailAddress;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public String getIdDepartment() {
|
||||
return idDepartment;
|
||||
}
|
||||
//セッター
|
||||
public void setIdEmployee(String idEmployee) {
|
||||
//nullチェック
|
||||
if (idEmployee == null) {
|
||||
System.out.println("社員IDが空のため設定できませんでした");
|
||||
return;
|
||||
}
|
||||
//空文字チェック
|
||||
if (idEmployee.trim().isEmpty()) {
|
||||
System.out.println( "社員IDが空のため設定できませんでした");
|
||||
return;
|
||||
}
|
||||
this.idEmployee = idEmployee;
|
||||
}
|
||||
public void setNmEmployee(String nmEmployee) {
|
||||
//nullチェック
|
||||
if (nmEmployee == null) {
|
||||
System.out.println("社員名が空のため設定できませんでした");
|
||||
return;
|
||||
}
|
||||
//空文字チェック
|
||||
if (nmEmployee.trim().isEmpty()) {
|
||||
System.out.println("社員名が空のため設定できませんでした");
|
||||
return;
|
||||
}
|
||||
this.nmEmployee = nmEmployee;
|
||||
}
|
||||
public void setKnEmployee(String knEmployee) {
|
||||
this.knEmployee = knEmployee;
|
||||
}
|
||||
public void setMailAddress(String mailAddress) {
|
||||
this.mailAddress = mailAddress;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public void setIdDepartment(String idDepartment) {
|
||||
this.idDepartment = idDepartment;
|
||||
}
|
||||
//toString
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
//まとめて表示
|
||||
public void showInfo() {
|
||||
return getIdEmployee() + "\t"
|
||||
+ getNmEmployee() + "\t"
|
||||
+ getKnEmployee() + "\t"
|
||||
+ getMailAddress() + "\t"
|
||||
+ getPassword() + "\t"
|
||||
+ getIdDepartment();
|
||||
}
|
||||
|
||||
System.out.println(this.idEmployee + "\t"
|
||||
+ this.nmEmployee + "\t"
|
||||
+ this.knEmployee + "\t"
|
||||
+ this.mailAddress + "\t"
|
||||
+ this.password + "\t"
|
||||
+ this.idDepartment);
|
||||
}
|
||||
//IDチェック
|
||||
public boolean isMatchId(String id) {
|
||||
|
||||
if (this.idEmployee.equals(id)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//ID一致判定
|
||||
public boolean isMatchId(String id) {
|
||||
return getIdEmployee().equals(id);
|
||||
}
|
||||
//件数取得
|
||||
public static int getEmpCount() {
|
||||
return empCount;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user