段階4完了

This commit is contained in:
2026-09-16 14:53:11 +09:00
parent eb595c96fc
commit 5fe3b0120f
2 changed files with 23 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
public class EmployeeData {
public class EmployeeData extends BaseDate {
private String idEmployee;
private String nmEmployee;
private String knEmployee;
@@ -71,6 +71,11 @@ public class EmployeeData {
public EmployeeData(String idEmployee, String nmEmployee, String knEmployee, String mailAddress, String password,
String idDepartment) {
idEmployee = idEmployee.trim();
int in =idEmployee.length();
if (in==0) {
nmEmployee ="社員IDが空のため設定できませんでした";
}
this.setIdEmployee(idEmployee);
nmEmployee = nmEmployee.trim();
int i =nmEmployee.length();
@@ -88,4 +93,17 @@ public class EmployeeData {
int result = empCount;
return result;
}
@Override
public String toCSV() {
String str;
str = (getIdEmployee() + "," + getNmEmployee() + "," + getKnEmployee() + "," + getMailAddress()
+ "," + getPassword() + "," + getIdDepartment());
return str;
}
@Override
public String getPrimaryKeyValue() {
return idEmployee;
}
}

View File

@@ -4,7 +4,7 @@ public class Main {
public static void main(String[] args) {
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[2] = new EmployeeData("10002","麻枝史明","マエダフミアキ","fmak@hoge.jp","ccc","12");
employee[3] = new EmployeeData("10003","丸戸章介","マルトショウスケ","marusyo@hoge.jp","ddd","13");
@@ -16,6 +16,9 @@ public class Main {
}
int i=EmployeeData.getEmpCount();
System.out.println("現在の社員データ件数;"+ i + "件");
System.out.println(employee[0].toCSV());
System.out.println(employee[0].getPrimaryKeyValue());
}
}