Day2_6段階目
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
|
||||
public class EmployeeData {
|
||||
|
||||
|
||||
private String idEmployee;
|
||||
private String nmEmployee;
|
||||
private String knEmployee;
|
||||
@@ -9,7 +8,28 @@ public class EmployeeData {
|
||||
private String password;
|
||||
private String idDepartment;
|
||||
|
||||
//引数なしコンストラクタ
|
||||
public EmployeeData() {
|
||||
|
||||
}
|
||||
|
||||
//6つの引数をもつコンストラクタ
|
||||
public EmployeeData(
|
||||
String idEmployee,
|
||||
String nmEmployee,
|
||||
String knEmployee,
|
||||
String mailAddress,
|
||||
String password,
|
||||
String idDepartment) {
|
||||
|
||||
this.setIdEmployee(idEmployee);
|
||||
this.setNmEmployee(nmEmployee);
|
||||
this.setKnEmployee(knEmployee);
|
||||
this.setMailAddress(mailAddress);
|
||||
this.setPassword(password);
|
||||
this.setIdDepartment(idDepartment);
|
||||
|
||||
}
|
||||
|
||||
public String getIdEmployee() {
|
||||
return idEmployee;
|
||||
@@ -59,23 +79,20 @@ public class EmployeeData {
|
||||
this.idDepartment = idDepartment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
|
||||
void showInfo() {
|
||||
|
||||
System.out.println(
|
||||
this.getIdEmployee() + "\t"
|
||||
return this.getIdEmployee() + "\t"
|
||||
+ this.getNmEmployee() + "\t"
|
||||
+ this.getKnEmployee() + "\t"
|
||||
+ this.getMailAddress() + "\t"
|
||||
+ this.getPassword() + "\t"
|
||||
+ this.getIdDepartment()
|
||||
);
|
||||
+ this.getIdDepartment();
|
||||
|
||||
}
|
||||
|
||||
public boolean isMatchID(String id) {
|
||||
return this.idEmployee.equals(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -52,11 +52,16 @@ public class Main {
|
||||
Employees[4].setIdDepartment("13");
|
||||
|
||||
|
||||
for (int i = 0; i < Employees.length; i++) {
|
||||
System.out.println(Employees[i]);
|
||||
|
||||
}
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
|
||||
while(true) {
|
||||
System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
|
||||
String id = scanner.nextLine();
|
||||
while(true) {
|
||||
// System.out.println("検索したい社員IDを入力してください(終了する場合は0)");
|
||||
String id = scanner.nextLine();
|
||||
|
||||
if(id.equals("0")) {
|
||||
System.out.println("システムを終了します");
|
||||
@@ -68,7 +73,7 @@ public class Main {
|
||||
for (int i = 0; i < Employees.length; i++) {
|
||||
|
||||
if(Employees[i].isMatchID(id)) {
|
||||
Employees[i].showInfo();
|
||||
System.out.println(Employees[i]);
|
||||
found = true;
|
||||
}
|
||||
|
||||
@@ -87,10 +92,6 @@ public class Main {
|
||||
// System.out.println(Employees.password);
|
||||
// System.out.println(Employees.idDepartment);
|
||||
|
||||
// for (int i = 0; i < Employees.length; i++) {
|
||||
// Employees[i].showInfo();
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user