2日目段階7です

This commit is contained in:
2026-09-24 15:28:04 +09:00
parent a7ab96fe7d
commit 83691c5691
2 changed files with 23 additions and 8 deletions

View File

@@ -6,9 +6,10 @@ public class EmployeeData extends BaseData {
private String mailAddress; private String mailAddress;
private String password; private String password;
private String idDepartment; private String idDepartment;
private static int empCount = 0;
EmployeeData() { EmployeeData() {
empCount = empCount + 1;
} }
EmployeeData(String idEmployee, String nmEmployee, String knEmployee, String mailAddress, String password, EmployeeData(String idEmployee, String nmEmployee, String knEmployee, String mailAddress, String password,
@@ -19,6 +20,7 @@ public class EmployeeData extends BaseData {
setMailAddress(mailAddress); setMailAddress(mailAddress);
setPassword(password); setPassword(password);
setIdDepartment(idDepartment); setIdDepartment(idDepartment);
empCount = empCount + 1;
} }
public String getIdEmployee() { public String getIdEmployee() {
@@ -69,17 +71,25 @@ public class EmployeeData extends BaseData {
this.idDepartment = idDepartment; this.idDepartment = idDepartment;
} }
public static int getEmpCount() {
return empCount;
}
public static void setEmpCount(int empCount) {
EmployeeData.empCount = empCount;
}
@Override @Override
public String toString() { public String toString() {
return getIdEmployee() + "\t" + getNmEmployee() + "\t" + getKnEmployee() + "\t" + getMailAddress() return getIdEmployee() + "\t" + getNmEmployee() + "\t" + getKnEmployee() + "\t" + getMailAddress()
+ "\t" + getPassword() + "\t" + getIdDepartment(); + "\t" + getPassword() + "\t" + getIdDepartment();
} }
// public boolean isMatchId(String id) { // public boolean isMatchId(String id) {
// //
// return idEmployee.equals(id); // return idEmployee.equals(id);
// //
// } // }
public String toCSV() { public String toCSV() {
return getIdEmployee() + "," + getNmEmployee() + "," + getKnEmployee() + "," + getMailAddress() return getIdEmployee() + "," + getNmEmployee() + "," + getKnEmployee() + "," + getMailAddress()
@@ -89,4 +99,8 @@ public class EmployeeData extends BaseData {
public String getPrimaryKeyValue() { public String getPrimaryKeyValue() {
return idEmployee; return idEmployee;
} }
public static int empCount() {
return empCount;
}
} }

View File

@@ -43,10 +43,11 @@ public class Main {
allData[8] = dept3; allData[8] = dept3;
allData[9] = dept4; allData[9] = dept4;
allData[10] = dept5; allData[10] = dept5;
for (int i = 0; i < allData.length; i++) { for (int i = 0; i < allData.length; i++) {
System.out.println(allData[i]); System.out.println(allData[i]);
} }
System.out.println("現在の社員データ件数"+ EmployeeData.getEmpCount()+ "件");
for (int i = 0; i < allData.length; i++) { for (int i = 0; i < allData.length; i++) {
@@ -55,7 +56,7 @@ public class Main {
bo = true; bo = true;
System.out.println(allData[i]); System.out.println(allData[i]);
// System.out.println(employee.toCSV(F)); // System.out.println(employee.toCSV());
// System.out.println(employee.getPrimaryKeyValue()); // System.out.println(employee.getPrimaryKeyValue());
} }