Skip to content

Commit d8d99ab

Browse files
committed
Java Assignment3 upload by HoonSubKim
1 parent ca7f7c8 commit d8d99ab

File tree

18 files changed

+477
-0
lines changed

18 files changed

+477
-0
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/KDTBE5_Java_Assignment3.iml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/discord.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

day05assignment/day05assignment.iml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$">
6+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
7+
</content>
8+
<orderEntry type="jdk" jdkName="11" jdkType="JavaSDK" />
9+
<orderEntry type="sourceFolder" forTests="false" />
10+
</component>
11+
</module>
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package me.day05.practice.practice01;
2+
3+
import me.day05.practice.practice01.constant.AuthMethod;
4+
import me.day05.practice.practice01.constant.Company;
5+
6+
import java.time.LocalDate;
7+
import java.util.ArrayList;
8+
import java.util.Arrays;
9+
import java.util.List;
10+
import java.util.Objects;
11+
12+
public class Electronic {
13+
private static int autoIncrementNumber = 0;
14+
private String productNo;
15+
private String modelName;
16+
private Company companyName;
17+
private String dateOfDate;
18+
private AuthMethod[] authMethod;
19+
20+
public Electronic(String productNo,
21+
String modelName,
22+
Company companyName,
23+
String dateOfDate
24+
) {
25+
this.productNo = this.generateProductNo();
26+
this.modelName = modelName;
27+
this.companyName = companyName;
28+
this.dateOfDate = dateOfDate;
29+
this.authMethod = new AuthMethod[10];
30+
}
31+
32+
private String generateProductNo() {
33+
String id = String.format("%04d", ++autoIncrementNumber);
34+
String generatedDate = LocalDate.now().toString().replace("-", "").substring(2);
35+
return generatedDate + id;
36+
}
37+
38+
public String getProductNo() {
39+
return productNo;
40+
}
41+
42+
public String getModelName() {
43+
return modelName;
44+
}
45+
46+
public void setModelName(String modelName) {
47+
this.modelName = modelName;
48+
}
49+
50+
public Company getCompanyName() {
51+
return companyName;
52+
}
53+
54+
public void setCompanyName(Company companyName) {
55+
this.companyName = companyName;
56+
}
57+
58+
public String getDateOfDate() {
59+
return dateOfDate;
60+
}
61+
62+
public void setDateOfDate(String dateOfDate) {
63+
this.dateOfDate = dateOfDate;
64+
}
65+
66+
public AuthMethod[] getAuthMethod() {
67+
return authMethod;
68+
}
69+
public void setAuthMethod(AuthMethod[] authMethod) {
70+
this.authMethod = authMethod;
71+
}
72+
73+
@Override
74+
public boolean equals(Object obj) {
75+
if (this == obj) return true;
76+
if (obj == null || this.getClass() != obj.getClass()) return false;
77+
78+
Electronic that = (Electronic) obj;
79+
return Objects.equals(this.productNo, that.productNo); // Unique한 id 값을 가지고 있기 때문에 이렇게 작성
80+
}
81+
82+
@Override
83+
public int hashCode() {
84+
return Objects.hash(productNo,
85+
modelName,
86+
companyName,
87+
dateOfDate
88+
);
89+
}
90+
91+
@Override
92+
public String toString() {
93+
return "Electronic{" +
94+
"productNo='" + productNo + "'" +
95+
", modelName='" + modelName + "'" +
96+
", companyName=" + companyName +
97+
", dateOfDate='" + dateOfDate + "'" +
98+
", authMethod=" + Arrays.toString(authMethod) +
99+
'}';
100+
}
101+
}
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
package me.day05.practice.practice01;
2+
3+
import java.time.LocalDateTime;
4+
import java.util.Arrays;
5+
import java.util.Objects;
6+
7+
public class User {
8+
private String userId;
9+
private String userPassword;
10+
private String userPhoneNumber;
11+
private String userEmail;
12+
private String userBirthDate;
13+
private Electronic[] electronicDevices;
14+
private LocalDateTime registerTime;
15+
16+
public User() {
17+
this.electronicDevices = new Electronic[10];
18+
this.registerTime = LocalDateTime.now();
19+
}
20+
public User(String userId,
21+
String userPassword,
22+
String userPhoneNumber,
23+
String userEmail,
24+
String userBirthDate
25+
) {
26+
this();
27+
this.userId = userId;
28+
this.userPassword = userPassword;
29+
this.userPhoneNumber = userPhoneNumber;
30+
this.userEmail = userEmail;
31+
this.userBirthDate = userBirthDate;
32+
}
33+
34+
public String getUserId() {
35+
return userId;
36+
}
37+
38+
public void setUserId(String userId) {
39+
this.userId = userId;
40+
}
41+
42+
public String getUserPassword() {
43+
return userPassword;
44+
}
45+
46+
public void setUserPassword(String userPassword) {
47+
this.userPassword = userPassword;
48+
}
49+
50+
public String getUserPhoneNumber() {
51+
return userPhoneNumber;
52+
}
53+
54+
public void setUserPhoneNumber(String userPhoneNumber) {
55+
this.userPhoneNumber = userPhoneNumber;
56+
}
57+
58+
public String getUserEmail() {
59+
return userEmail;
60+
}
61+
62+
public void setUserEmail(String userEmail) {
63+
this.userEmail = userEmail;
64+
}
65+
66+
public String getUserBirthDate() {
67+
return userBirthDate;
68+
}
69+
70+
public void setUserBirthDate(String userBirthDate) {
71+
this.userBirthDate = userBirthDate;
72+
}
73+
74+
public LocalDateTime getRegisterTime() {
75+
return registerTime;
76+
}
77+
78+
public void setRegisterTime(LocalDateTime registerTime) {
79+
this.registerTime = registerTime;
80+
}
81+
82+
public Electronic[] getElectronicDevices() {
83+
return electronicDevices;
84+
}
85+
86+
public void setElectronicDevices(Electronic[] electronicDevices) {
87+
this.electronicDevices = electronicDevices;
88+
}
89+
90+
@Override
91+
public boolean equals(Object obj) {
92+
if (this == obj) return true;
93+
if (obj == null || this.getClass() != obj.getClass()) return false;
94+
95+
User user = (User) obj;
96+
97+
if (!Objects.equals(userId, user.userId)) return false;
98+
if (!Objects.equals(userPassword, user.userPassword)) return false;
99+
if (!Objects.equals(userPhoneNumber, user.userPhoneNumber)) return false;
100+
if (!Objects.equals(userEmail, user.userEmail)) return false;
101+
if (!Objects.equals(userBirthDate, user.userBirthDate)) return false;
102+
return Objects.equals(registerTime, user.registerTime);
103+
}
104+
105+
@Override
106+
public int hashCode() {
107+
return Objects.hash(userId,
108+
userPassword,
109+
userPhoneNumber,
110+
userEmail,
111+
userBirthDate,
112+
registerTime
113+
);
114+
}
115+
116+
@Override
117+
public String toString() {
118+
return "User{" +
119+
"userId='" + userId + "'" +
120+
", userPassword='" + userPassword + "'" +
121+
", userPhoneNumber='" + userPhoneNumber + "'" +
122+
", userEmail='" + userEmail + "'" +
123+
", userBirthDate='" + userBirthDate + "'" +
124+
", electronicDevices=" + Arrays.toString(electronicDevices) +
125+
", registerTime=" + registerTime +
126+
'}';
127+
}
128+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package me.day05.practice.practice01.constant;
2+
3+
public enum AuthMethod {
4+
FINGER_PRINT, PATTERN, PIN, FACE;
5+
}

0 commit comments

Comments
 (0)