Skip to content

[박준용_BackEnd] 1주차 과제 제출합니다.#16

Open
rhldial wants to merge 8 commits intoBCSDLab-Edu:mainfrom
rhldial:main
Open

[박준용_BackEnd] 1주차 과제 제출합니다.#16
rhldial wants to merge 8 commits intoBCSDLab-Edu:mainfrom
rhldial:main

Conversation

@rhldial
Copy link
Copy Markdown

@rhldial rhldial commented Mar 30, 2026

No description provided.

@rhldial
Copy link
Copy Markdown
Author

rhldial commented Mar 30, 2026

마지막에 파일 날려서 늦었습니다.

printWinners(cars, distances);
}

private static String[] inputCarList(){
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 메서드는 입력받기, 문자열 분리, 중복 검사, 이름 검증까지 함께 담당하고 있는 것으로 보입니다! 메서드를 조금 더 나누면 각 메서드의 역할이 더 분명해져서 읽기 좋아질 것 같습니다!!

String carName = Console.readLine(); //이름 입력받기
String[] names = carName.split(",", -1); //쉼표 구분

for (int i = 0; i < names.length; i++) { //이름 중북 불가능
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이 아래 부분은 for문 안에 또 다른 for문과 if문이 들어가 있어서, 인덴트 depth 제한을 한 번 다시 확인해보시면 좋을 것 같습니다! 1주차 요구사항과 함께 보면 이 부분은 조금 더 단순하게 나눠볼 수 있을 것 같습니다!!


System.out.print("최종 우승자 : ");
boolean first = true; //우승자 중 맨앞
for (int i = 0; i < cars.length; i++) { //최대거리로 우승자 찾기
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

우승자 출력 부분도 조건이 여러 단계로 들어가 있어서 depth가 깊어지는 느낌입니다! 출력 로직을 조금 분리해주시면 더 깔끔하게 보일 것 같습니다!!

public class Application {
public static void main(String[] args) {
// TODO: 프로그램 구현
String[] cars = inputCarList();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

main()에서 전체 흐름을 입력 → 진행 → 우승자 출력 순서로 나누어 둔 점은 좋았습니다! 처음 구현에서도 프로그램 흐름이 한눈에 들어오도록 정리한 점이 좋아 보입니다!!


public class Application {
public static void main(String[] args) {
// TODO: 프로그램 구현
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이미 구현이 완료된 상태라면 이 주석은 이제 역할이 거의 없어 보입니다! 제출 전에 이런 기본 TODO 주석은 정리해두시면 코드가 더 깔끔해질 것 같습니다!!

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