1日目 段階8 小澤

This commit is contained in:
2026-09-18 13:07:29 +09:00
parent 21c95b996f
commit c49e595ba5
2 changed files with 29 additions and 13 deletions

View File

@@ -10,6 +10,11 @@ public class EmployeeData extends BaceData {
static final String COMPANY_NAME = "Rhizome"; static final String COMPANY_NAME = "Rhizome";
public void showInfo() {
System.out.println(this.idEmployee + "\t" + this.nmEmployee + "\t" + this.knEmployee + "\t" + this.mailAddress
+ "\t" + this.mailAddress + "\t" + this.password + "\t" + this.idDepartment);
}
@Override @Override
public String toString() { public String toString() {
return getIdEmployee() + "\t" + getNmEmployee() + " " + getKnEmployee() + "\t" + getMailAddress() return getIdEmployee() + "\t" + getNmEmployee() + " " + getKnEmployee() + "\t" + getMailAddress()

View File

@@ -1,3 +1,4 @@
import java.util.Scanner;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
@@ -39,25 +40,35 @@ public class Main {
// System.out.println(employees[1].toCSV()); // System.out.println(employees[1].toCSV());
// System.out.println(employees[1].getPrimaryKeyValue()); // System.out.println(employees[1].getPrimaryKeyValue());
System.out.println("10002を検索します"); Scanner sc = new Scanner(System.in);
System.out.println("検索したい社員IDを入力してください");
String id = sc.nextLine();
boolean result = false; boolean result = false;
for (int i = 0; i < employees.length; i++) { for (int i = 0; i < employees.length; i++) {
if (employees[i].isMatchId("10002")) { if (employees[i].isMatchId(id)) {
result = true; result = true;
employees[i].showInfo();
break; break;
} }
} }
System.out.println(result);
System.out.println("99999を検索します"); if(result==false) {
result=false; System.out.println("該当する社員が見つかりませんでした");
for(int i=0;i<employees.length;i++) {
if(employees[i].isMatchId("99999")) {
result = true;
break;
} }
} }
System.out.println(result);
// System.out.println("99999を検索します");
// result = false;
// for (int i = 0; i < employees.length; i++) {
// if (employees[i].isMatchId("99999")) {
// result = true;
// break;
// }
// }
// System.out.println(result);
// //
// } // }
@@ -84,4 +95,4 @@ public class Main {
} }
}