1日目段階9終了

This commit is contained in:
2026-09-17 13:40:31 +09:00
parent e0c820be50
commit 70b3359a0d

View File

@@ -3,14 +3,13 @@ import java.util.Scanner;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
while (true) {
Scanner scanner = new Scanner(System.in); Scanner scanner = new Scanner(System.in);
System.out.println("検索したい社員IDを入力してください"); System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
String input = scanner.nextLine(); String input = scanner.nextLine();
BaseData[] employees = new BaseData[5]; BaseData[] employees = new BaseData[5];
BaseData employee = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
employees[0] = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10"); employees[0] = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
employees[1] = new EmployeeData("10001", "高橋準", "タカハシジュン", "jtaka@hoge.jp", "bbb", "10"); employees[1] = new EmployeeData("10001", "高橋準", "タカハシジュン", "jtaka@hoge.jp", "bbb", "10");
@@ -26,33 +25,30 @@ public class Main {
// //
// System.out.println("現在の社員データ件数:" + EmployeeData.getEmpCount() + "件"); // System.out.println("現在の社員データ件数:" + EmployeeData.getEmpCount() + "件");
String serchId1 = "10002"; String serchId1 = "10002";
// System.out.println(serchId1 + "を検索します"); // System.out.println(serchId1 + "を検索します");
// boolean bo = false; // boolean bo = false;
// for (int i = 0; i < employees.length; i++) { // for (int i = 0; i < employees.length; i++) {
// if (((EmployeeData) employees[i]).isMatchId(serchId1)) { // if (((EmployeeData) employees[i]).isMatchId(serchId1)) {
// bo = true; // bo = true;
// break; // break;
// } // }
// //
// } // }
// System.out.println(bo); // System.out.println(bo);
String serchId2 = "99999"; String serchId2 = "99999";
// System.out.println(serchId2 + "を検索します"); // System.out.println(serchId2 + "を検索します");
// boolean bl = false; // boolean bl = false;
// for (int i = 0; i < employees.length; i++) { // for (int i = 0; i < employees.length; i++) {
// if (((EmployeeData) employees[i]).isMatchId(serchId2)) { // if (((EmployeeData) employees[i]).isMatchId(serchId2)) {
// bl = true; // bl = true;
// break; // break;
// } // }
// } // }
// System.out.println(bl); // System.out.println(bl);
boolean a = false; boolean a = false;
for(int i = 0; i < employees.length; i++) { for (int i = 0; i < employees.length; i++) {
if (((EmployeeData) employees[i]).isMatchId(input)) { if (((EmployeeData) employees[i]).isMatchId(input)) {
a = true; a = true;
System.out.println(employees[i]); System.out.println(employees[i]);
@@ -63,15 +59,14 @@ public class Main {
if (!a) { if (!a) {
System.out.println("該当する社員が見つかりませんでした"); System.out.println("該当する社員が見つかりませんでした");
} }
if (input.equals("0")) {
System.out.println("システムを終了します");
break;
}
BaseData employee = new EmployeeData("10000", "山田龍也", "ヤマダタツヤ", "yamada@hoge.jp", "aaa", "10");
// System.out.println(employee.toCSV()); // System.out.println(employee.toCSV());
// System.out.println(employee.getPrimaryKeyValue()); // System.out.println(employee.getPrimaryKeyValue());
}
} }
} }