Skip to content

[김형민_BackEnd] 1주차 과제 제출합니다.#8

Open
Zeoung wants to merge 2 commits intoBCSDLab-Edu:mainfrom
Zeoung:main
Open

[김형민_BackEnd] 1주차 과제 제출합니다.#8
Zeoung wants to merge 2 commits intoBCSDLab-Edu:mainfrom
Zeoung:main

Conversation

@Zeoung
Copy link
Copy Markdown

@Zeoung Zeoung commented Mar 30, 2026

https://docs.google.com/document/d/19UBYJR4N53QwdMdhkpWayIGsIPxRMWOzKYSYdrHvtGo/edit?tab=t.0
구글문서 안에 구현한 기능 목록과 작성한 자바 코드가 있습니다.
그리고 처음으로 코딩 동아리 같은 곳에서 해서 그런지 많이 어렵다고 느꼈습니다.
그리고 앞으로도 계속 이런 방식으로 과제를 내는지 궁금합니다.

Copy link
Copy Markdown
Collaborator

@dh2906 dh2906 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 메소드도 역할 별로 잘 나누셨고, 전체적으로 깔끔하네요 👍
이젠 하나의 파일에 모든 코드가 들어가는 것보다 역할 별로 파일을 분리하는걸 신경써주시면 좋을 듯 싶어요.
커밋도 범위가 너무 커서 앞으로는 기능 하나(입력, 클래스 생성, 우승자 구하기 등등...) 별로 커밋을 작성하시거나, 더 작은 범위로 쪼개주세요!

구글문서 안에 구현한 기능 목록과 작성한 자바 코드가 있습니다.

  • 권한 제한 걸려있는데 승인 부탁드립니당

그리고 앞으로도 계속 이런 방식으로 과제를 내는지 궁금합니다.

  • 넵 앞으로도 같은 방식으로 과제가 매주 나갈 예정입니다.
  • 그러니 매일 시간날 때마다 과제 수행하시는게 훨씬 편할거에요

* 자동차 이름이 5자를 초과하거나 비어있는지 확인합니다.
*/
private static void validateName(String name) {
if (name.isEmpty() || name.length() > 5) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

isEmpty()도 있지만 isBlank()도 있습니다. 둘의 차이는 무엇일까요??

// 요구 사항: 0에서 9 사이의 무작위 값 구하기
int randomNumber = Randoms.pickNumberInRange(0, 9);
// 요구 사항: 무작위 값이 4 이상일 경우 전진
if (randomNumber >= 4) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

4 라는 매직 넘버는 상수화를 해주시는게 좋아요

참고자료

private static int getMaxPosition(List<Car> cars) {
int max = 0;
for (Car car : cars) {
// 3항 연산자를 쓰지 않기 위해 Math.max 사용
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

👍

Comment on lines +149 to +151
public Car(String name) {
this.name = name;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

여기서 자동차의 이름을 검증하는 로직이 들어갈 수도 있지 않을까요?!
물론 이건 정답이 없습니다!





Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

불필요한 라인은 제거해주세용

Comment on lines +19 to +36
// 1. 자동차 이름 입력 및 객체 생성
System.out.println("경주할 자동차 이름을 입력하세요.(이름은 쉼표(,) 기준으로 구분)");
String inputNames = Console.readLine();
List<Car> cars = createCars(inputNames);

// 2. 시도 횟수 입력
System.out.println("시도할 회수는 몇회인가요?");
int tryCount = parseTryCount(Console.readLine());

// 3. 경주 진행 및 결과 출력
System.out.println("\n실행 결과");
for (int i = 0; i < tryCount; i++) {
playRound(cars); // 한 라운드 진행
printRoundResult(cars); // 결과 출력
}

// 4. 최종 우승자 판별 및 출력
printFinalWinner(cars);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

지금도 충분히 메소드를 잘 나누셨지만, 주석에 적어두신대로 각 단계를 메소드 하나로 묶는건 어떻게 생각하시나용

Comment on lines +84 to +86
int randomNumber = Randoms.pickNumberInRange(0, 9);
// 요구 사항: 무작위 값이 4 이상일 경우 전진
if (randomNumber >= 4) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
int randomNumber = Randoms.pickNumberInRange(0, 9);
// 요구 사항: 무작위 값이 4 이상일 경우 전진
if (randomNumber >= 4) {
if (Randoms.pickNumberInRange(0, 9) >= 4) {

이렇게하면 randomNumber 변수가 필요 없어져요!

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