Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Assignment3 upload by TaeIlKIm #13

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

james-taeil
Copy link

실습 2번

  • 깊은 복사에 대한 이해가 부족하여, 여러 레퍼런스 참고하여 풀었습니다.
  • 아직도 이해가 잘 안됍니다.

실습 3번

  • 3 - 3, 3 - 4 // 배열의 특성을 잘 모르고 푼 것 같습니다.
  • 문제 의도는 Eletronic[] 을 사용하여 푸는 것 같은데 ArrayList<> 로 풀었다가 다른 레퍼런스 참고하여 풀었습니다.
  • CAPACITY 를 왜 사용하고 어떤 방식으로 사용하는지 잘 모르겠습니다.

@james-taeil
Copy link
Author

james-taeil commented Apr 17, 2023

  • 3 - 2 번도 코드 한번 봐주시고, 리펙토링 부탁드립니다..

Copy link

@lalwr lalwr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

과제하느라 고생하셨습니다 👍
깊은 복사와 얕은 복사에 대해 현재 이해하고 있는 부분을 정리해보시고 이해가 안되는 부분에 대해 얘기를 하면 좋을꺼 같습니다~
CAPACITY 는 기본 배열 크기를 지정하기 위해 사용하는 것이 목적입니다.

만든 코드에 대한 테스트 코드도 작성해보시면 좋지 않을까요?

public class Electronic {
private static int serialNumber = 0;

String productNo;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

접근제한자가 없는 이유가 있을까요?

this.productNo = today.format(DateTimeFormatter.ofPattern("yyMMdd"));
this.productNo += String.format("%04d", serialNumber);
this.companyName = companyName;
authMethods.add(auth);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

authMethods도 리스트로 받는것이 좋지 않을까요?

this.userPhoneNumber = userPhoneNumber;
this.userEmail = userEmail;
this.userBirthDate = userBirthDate;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

registerTime 셋팅하는 부분이 빠졌네요.

String userPhoneNumber,
String userEmail,
String userBirthDate

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

electronicDevices 는 빠진 이유가 있을까요?


// 싱글톤
private static Users instance;
public Users() {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public 으로 객체가 생성하면 싱글톤이 아니지 않을까요?


public Electronic findByProductNo(String productNo) {
for (Electronic electronic : electronicList) {
if (electronic.getProductNo().equals(productNo)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

equals 👍

private static Electronics instance;
private static final int DEFAULT_CAPACITY = 10;
private Electronic[] electronicList;
private int size = 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size 를 셋팅하는 부분은 어디있나요?

int count = 0;
for (int i = 0; i < electronicList.length; i++) {
if (electronicList[i].getCompanyName().equals(company)) {
groupByCompanyElectronic[count] = electronicList[i];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

배열에 넣은 후 count 를 증가해야 하지 않을까요?

int count = 0;
for (int i = 0; i < electronicList.length; i++) {
if (electronicList[i].getAuthMethods().equals(authMethod)) {
groupByCompanyElectronic[count] = electronicList[i];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

배열에 넣은 후 count 를 증가해야 하지 않을까요?

public class Electronics {

private static Electronics instance;
private static final int DEFAULT_CAPACITY = 10;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

기본 배열 크기를 지정하는 용도로 사용합니다.

@james-taeil james-taeil reopened this Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants