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