Skip to content

Conversation

@bajirakhyeonhee
Copy link

No description provided.

@bajirakhyeonhee bajirakhyeonhee changed the title [BackEnd_임현희] [임현희_BackEnd] 1주차 과제 제출합니다. Mar 26, 2025
@bajirakhyeonhee
Copy link
Author

PR을 잘못 제출했다는 것을 오늘 알고 늦게 제출했습니다.. 그렇다고 완벽한 코드는 아니지만 계속 고쳐보도록 하겠습니다 죄송합니다

Copy link

@dradnats1012 dradnats1012 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다!
중복되는 내용에 대한 리뷰는 한번만 남겼는데 확인하고 모두 적용해보면 좋을 것 같아요~!

public class Application {
public static void main(String[] args) {
// TODO: 프로그램 구현
ArrayList<Car> cars = new ArrayList<>();

Choose a reason for hiding this comment

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

Suggested change
ArrayList<Car> cars = new ArrayList<>();
List<Car> cars = new ArrayList<>();

보통 이렇게 선언해서 사용합니다!
저번주 강의 보시고 다형성에 대해 공부해보면 좋을 것 같아요 :)

System.out.println("경주할 자동차 이름을 입력하세요.");
String name = readLine();
String[] Name = name.split(",");
for(String n: Name){

Choose a reason for hiding this comment

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

n 이라는 변수명보다는 name으로 사용하면 좋을것 같아요

Suggested change
for(String n: Name){
for(String name: names){

ArrayList<Car> cars = new ArrayList<>();
System.out.println("경주할 자동차 이름을 입력하세요.");
String name = readLine();
String[] Name = name.split(",");

Choose a reason for hiding this comment

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

names 라는 네이밍은 어떨까요?

cars.add(car);
}
System.out.println("시도할 회수는 몇회인가요?");
int Count = Integer.parseInt(readLine());

Choose a reason for hiding this comment

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

변수명은 보통 소문자로 시작합니다!
카멜케이스에 대해 알아보고 적용해보면 좋을 것 같아요!


import java.util.ArrayList;

public class racing {

Choose a reason for hiding this comment

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

클래스는 대문자로 시작합니다!

Comment on lines 21 to 22


Choose a reason for hiding this comment

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

이 개행들은 지워도 될 것 같아요!


void move(){
int num = Randoms.pickNumberInRange(0,9);
if(num>4){

Choose a reason for hiding this comment

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

4라는 숫자가 무엇을 의미하는지 나타내줘도 좋을 것 같아요!
ex) private static final int MOVE_NUM = 4

this.Distance = "";
}

void move(){

Choose a reason for hiding this comment

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

접근제어자가 빠졌네요!
아니면 default로 사용한 이유가 있으실까요?

Comment on lines 5 to 6
protected String Name;
protected String Distance;

Choose a reason for hiding this comment

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

protected로 선언한 이유가 궁금해요

Comment on lines +8 to +9
if (Name == null || Name.length() > 5)
throw new IllegalArgumentException();

Choose a reason for hiding this comment

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

검증하는 로직은 메서드로 따로 빼도 좋을 것 같아요 :)

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