3日目 段階9 小澤
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
BaseData employee = new EmployeeData();
|
||||
@@ -16,6 +14,7 @@ public class Main {
|
||||
dept.setIdDepartment("10");
|
||||
dept.setNmDepartment("役員");
|
||||
allData[5] = dept;
|
||||
dept = new DepartmentData();
|
||||
dept.setIdDepartment("11");
|
||||
dept.setNmDepartment("人事・総務部");
|
||||
dept = new DepartmentData();
|
||||
@@ -36,14 +35,39 @@ public class Main {
|
||||
dept.setNmDepartment("営業企画部");
|
||||
allData[10] = dept;
|
||||
|
||||
DepartmentData dep = null;
|
||||
EmployeeData emp ;
|
||||
String nmD=null;
|
||||
|
||||
for (int i=0; i < allData.length; i++) {
|
||||
if (allData[i] instanceof DepartmentData) {
|
||||
dep = (DepartmentData) allData[i];
|
||||
if (dep.getNmDepartment().equals("システム開発事業部")) {
|
||||
nmD=dep.getIdDepartment();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < allData.length; i++) {
|
||||
if (allData[i] instanceof EmployeeData) {
|
||||
EmployeeData emp = (EmployeeData) allData[i];
|
||||
emp = (EmployeeData) allData[i];
|
||||
if (emp.getIdDepartment().equals(nmD)) {
|
||||
System.out.println(emp.getNmEmployee() + "\t" + emp.getMailAddress());
|
||||
}
|
||||
|
||||
System.out.println(emp.getMailAddress());
|
||||
}
|
||||
}
|
||||
|
||||
// for (int i = 0; i < allData.length; i++) {
|
||||
// if (allData[i] instanceof EmployeeData) {
|
||||
// EmployeeData emp = (EmployeeData) allData[i];
|
||||
// System.out.println(emp.getMailAddress());
|
||||
// }
|
||||
// }
|
||||
|
||||
// int emp=0;
|
||||
// int dep=0;
|
||||
// for(int i=0;i<allData.length;i++) {
|
||||
@@ -66,48 +90,50 @@ public class Main {
|
||||
// System.out.println(employees[0].toCSV());
|
||||
// System.out.println(employees[0].getPrimaryKeyValue());
|
||||
|
||||
Scanner sc = new Scanner(System.in);
|
||||
// Scanner sc = new Scanner(System.in);
|
||||
//
|
||||
// for (int i = 0; i < employees.length; i++) {
|
||||
// System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
|
||||
// String id = sc.nextLine();
|
||||
// boolean result = false;
|
||||
//
|
||||
// if (id.equals("0")) {
|
||||
// System.out.println("システムを終了します");
|
||||
// break;
|
||||
// }
|
||||
// if (employees[i].getPrimaryKeyValue().equals(id)) {
|
||||
// result = true;
|
||||
// employees[i].toString();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (result == false) {
|
||||
// System.out.println("該当する社員が見つかりませんでした");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
for (int i = 0; i < employees.length; i++) {
|
||||
System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
|
||||
String id = sc.nextLine();
|
||||
boolean result = false;
|
||||
// for(int i=0;i<5;i++) {
|
||||
// if(employee[i].getNmEmployee()==null) {
|
||||
// continue;
|
||||
// }
|
||||
// System.out.println(employee[i]);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// System.out.println("現在の社員データ数"+EmployeeData.getEmpCount());
|
||||
//
|
||||
// System.out.println(EmployeeData.COMPANY_NAME);
|
||||
|
||||
if (id.equals("0")) {
|
||||
System.out.println("システムを終了します");
|
||||
break;
|
||||
}
|
||||
if (employees[i].getPrimaryKeyValue().equals(id)) {
|
||||
result = true;
|
||||
employees[i].toString();
|
||||
// System.out.println();
|
||||
// System.out.println(employee.nmEmployee);
|
||||
// System.out.println(employee.knEmployee);
|
||||
// System.out.println(employee.mailAddress);
|
||||
// System.out.println(employee.password);
|
||||
// System.out.println(employee.idDepartment);
|
||||
|
||||
}
|
||||
|
||||
if (result == false) {
|
||||
System.out.println("該当する社員が見つかりませんでした");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// for(int i=0;i<5;i++) {
|
||||
// if(employee[i].getNmEmployee()==null) {
|
||||
// continue;
|
||||
// }
|
||||
// System.out.println(employee[i]);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// System.out.println("現在の社員データ数"+EmployeeData.getEmpCount());
|
||||
//
|
||||
// System.out.println(EmployeeData.COMPANY_NAME);
|
||||
|
||||
// System.out.println();
|
||||
// System.out.println(employee.nmEmployee);
|
||||
// System.out.println(employee.knEmployee);
|
||||
// System.out.println(employee.mailAddress);
|
||||
// System.out.println(employee.password);
|
||||
// System.out.println(employee.idDepartment);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user