-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
34 lines (31 loc) · 1021 Bytes
/
Copy pathPerson.java
File metadata and controls
34 lines (31 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.util.Date;
public class Person {
public int id;
public String name;
public String gender;
public Date birthDate;
public Department department;
public String division;
public int salary;
public Person(int id,String name,String gender,Date birthDate,String division,int salary){
this.id = id;
this.name = name;
this.gender = gender;
this.birthDate = birthDate;
this.division = division;
this.salary = salary;
this.department = new Department(id%5,Departments.values()[id % 5]);
}
@Override
public String toString() {
return "Person{" +
"id=" + id +
", name='" + name + '\'' +
", gender='" + gender + '\'' +
", birthDate=" + birthDate +
", department=" + department +
", division='" + division + '\'' +
", salary=" + salary +
'}';
}
}