Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a268bdb79 |
27
EmployeeData.java
Normal file
27
EmployeeData.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
public class EmployeeData {
|
||||||
|
String idEmployee;
|
||||||
|
String nmEmployee;
|
||||||
|
String knEmployee;
|
||||||
|
String mailAddress;
|
||||||
|
String password;
|
||||||
|
String idDepartment;
|
||||||
|
/*
|
||||||
|
public void output() {
|
||||||
|
System.out.println(this.idEmployee);
|
||||||
|
System.out.println(this.nmEmployee);
|
||||||
|
System.out.println(this.knEmployee);
|
||||||
|
System.out.println(this.mailAddress);
|
||||||
|
System.out.println(this.password);
|
||||||
|
System.out.println(this.idDepartment);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
public void showInfo() {
|
||||||
|
System.out.println(this.idEmployee + "\t" + this.nmEmployee + this.knEmployee +"\t" + this.mailAddress + "\t" + this.password + "\t" + this.idDepartment );
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMatchId(String id) {
|
||||||
|
return id.equals(this.idEmployee);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
public class EmployeeData {
|
|
||||||
//フィールド
|
|
||||||
String idEmployee;
|
|
||||||
String nmEmployee;
|
|
||||||
String knEmployee;
|
|
||||||
String mailAddress;
|
|
||||||
String password;
|
|
||||||
String idDepartment;
|
|
||||||
|
|
||||||
//メソッド
|
|
||||||
public void showInfo(String employee[]) {
|
|
||||||
System.out.println(this.idEmployee + "\t" + this.nmEmployee + "\t" + this.knEmployee + "\t" + this.mailAddress + "\t" + this.password + "\t" + this.idDepartment);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
78
Main.java
Normal file
78
Main.java
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
// TODO 自動生成されたメソッド・スタブ
|
||||||
|
/*
|
||||||
|
EmployeeData employee = new EmployeeData();
|
||||||
|
employee.idEmployee = "10000";
|
||||||
|
employee.nmEmployee = "山田龍也";
|
||||||
|
employee.knEmployee = "ヤマダタツヤ";
|
||||||
|
employee.mailAddress = "yamada@hoge.jp";
|
||||||
|
employee.password = "aaa";
|
||||||
|
employee.idDepartment = "10";
|
||||||
|
*/
|
||||||
|
// employee.output();
|
||||||
|
// employee.showInfo();
|
||||||
|
|
||||||
|
EmployeeData[] employees = new EmployeeData[5];
|
||||||
|
|
||||||
|
employees[0] = new EmployeeData();
|
||||||
|
employees[1] = new EmployeeData();
|
||||||
|
employees[2] = new EmployeeData();
|
||||||
|
employees[3] = new EmployeeData();
|
||||||
|
employees[4] = new EmployeeData();
|
||||||
|
|
||||||
|
employees[0].idEmployee = "10000";
|
||||||
|
employees[0].nmEmployee = "山田龍也";
|
||||||
|
employees[0].knEmployee = "ヤマダタツヤ";
|
||||||
|
employees[0].mailAddress = "yamada@hoge.jp";
|
||||||
|
employees[0].password = "aaa";
|
||||||
|
employees[0].idDepartment = "10";
|
||||||
|
|
||||||
|
employees[1].idEmployee = "10001";
|
||||||
|
employees[1].nmEmployee = "高橋準";
|
||||||
|
employees[1].knEmployee = "タカハシジュン";
|
||||||
|
employees[1].mailAddress = "jtaka@hoge.jp";
|
||||||
|
employees[1].password = "bbb";
|
||||||
|
employees[1].idDepartment = "10";
|
||||||
|
|
||||||
|
employees[2].idEmployee = "10002";
|
||||||
|
employees[2].nmEmployee = "麻枝史明";
|
||||||
|
employees[2].knEmployee = "ヤマダタツヤ";
|
||||||
|
employees[2].mailAddress = "fmak@hoge.jp";
|
||||||
|
employees[2].password = "ccc";
|
||||||
|
employees[2].idDepartment = "11";
|
||||||
|
|
||||||
|
employees[3].idEmployee = "10003";
|
||||||
|
employees[3].nmEmployee = "丸戸章介";
|
||||||
|
employees[3].knEmployee = "マルトショウスケ";
|
||||||
|
employees[3].mailAddress = "marusyo@hoge.jp";
|
||||||
|
employees[3].password = "ddd";
|
||||||
|
employees[3].idDepartment = "12";
|
||||||
|
|
||||||
|
employees[4].idEmployee = "10004";
|
||||||
|
employees[4].nmEmployee = "三宅武";
|
||||||
|
employees[4].knEmployee = "ミヤケタケシ";
|
||||||
|
employees[4].mailAddress = "miya@hoge.jp";
|
||||||
|
employees[4].password = "eee";
|
||||||
|
employees[4].idDepartment = "13";
|
||||||
|
|
||||||
|
for(int i= 0;i < employees.length; i++) {
|
||||||
|
employees[i].showInfo();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
System.out.println("10002 を検索します");
|
||||||
|
System.out.println(employees[2].isMatchId("10002"));
|
||||||
|
|
||||||
|
System.out.println("99999 を検索します");
|
||||||
|
System.out.println(employees[2].isMatchId("99999"));
|
||||||
|
*/
|
||||||
|
System.out.println("検索したい社員IDを入力してください");
|
||||||
|
Scanner sc = new Scanner(System.in);
|
||||||
|
String str = sc.nextLine();
|
||||||
|
System.out.println("");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
|
|
||||||
public class Main {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// TODO 自動生成されたメソッド・スタブ
|
|
||||||
|
|
||||||
EmployeeData[] employee = new EmployeeData[5];
|
|
||||||
|
|
||||||
//インスタンス生成
|
|
||||||
/*EmployeeData em1 = new EmployeeData();
|
|
||||||
EmployeeData em2 = new EmployeeData();
|
|
||||||
EmployeeData em3 = new EmployeeData();
|
|
||||||
EmployeeData em4 = new EmployeeData();
|
|
||||||
EmployeeData em5 = new EmployeeData();*/
|
|
||||||
|
|
||||||
|
|
||||||
//代入
|
|
||||||
employee[0].idEmployee = "10000";
|
|
||||||
employee[0].nmEmployee = "山田龍也";
|
|
||||||
employee[0].knEmployee = "ヤマダタツヤ";
|
|
||||||
employee[0].mailAddress = "yamada@hoge.jp";
|
|
||||||
employee[0].password = "aaa";
|
|
||||||
employee[0].idDepartment = "10";
|
|
||||||
|
|
||||||
employee[1].idEmployee = "10001";
|
|
||||||
employee[1].nmEmployee = "高橋準";
|
|
||||||
employee[1].knEmployee = "タカハシジュン";
|
|
||||||
employee[1].mailAddress = "jtaka@hoge.jp";
|
|
||||||
employee[1].password = "bbb";
|
|
||||||
employee[1].idDepartment = "10";
|
|
||||||
|
|
||||||
employee[2].idEmployee = "10002";
|
|
||||||
employee[2].nmEmployee = "麻枝史明";
|
|
||||||
employee[2].knEmployee = "マエダフミアキ";
|
|
||||||
employee[2].mailAddress = "fmak@hoge.jp";
|
|
||||||
employee[2].password = "ccc";
|
|
||||||
employee[2].idDepartment = "11";
|
|
||||||
|
|
||||||
employee[3].idEmployee = "10003";
|
|
||||||
employee[3].nmEmployee = "丸戸章介";
|
|
||||||
employee[3].knEmployee = "マルトショウスケ";
|
|
||||||
employee[3].mailAddress = "marusyo@hoge.jp";
|
|
||||||
employee[3].password = "ddd";
|
|
||||||
employee[3].idDepartment = "12";
|
|
||||||
|
|
||||||
employee[4].idEmployee = "10004";
|
|
||||||
employee[4].nmEmployee = "三宅武";
|
|
||||||
employee[4].knEmployee = "ミヤケタケシ";
|
|
||||||
employee[4].mailAddress = "miya@hoge.jp";
|
|
||||||
employee[4].password = "eee";
|
|
||||||
employee[4].idDepartment = "13";
|
|
||||||
|
|
||||||
/*メソッド呼び出し
|
|
||||||
for(int i = 0; i < 5; i++) {
|
|
||||||
employee[].showInfo();
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
|
|
||||||
public class ObjectSample {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
// TODO 自動生成されたメソッド・スタブ
|
|
||||||
//原本のコピー(インスタンス生成)
|
|
||||||
Student student1 = new Student();
|
|
||||||
Student student2 = new Student();
|
|
||||||
|
|
||||||
//name、ageへの代入
|
|
||||||
student1.name = "田中";
|
|
||||||
student1.age = 30;
|
|
||||||
|
|
||||||
student2.name = "山本";
|
|
||||||
student2.age = 25;
|
|
||||||
|
|
||||||
//introduceメソッドの呼び出し
|
|
||||||
student1.intoroduce();
|
|
||||||
|
|
||||||
student2.intoroduce();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
public class Student {
|
|
||||||
//フィールドの宣言
|
|
||||||
String name;
|
|
||||||
int age;
|
|
||||||
|
|
||||||
//メソッドの定義
|
|
||||||
public void intoroduce() {
|
|
||||||
System.out.println("私の名前は" + this.name);
|
|
||||||
System.out.println("年齢は" + this.age);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user