Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
rootProject.name = 'java-racingcar'

include '1'
27 changes: 26 additions & 1 deletion src/main/java/racingcar/Application.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
package racingcar;

import java.util.Scanner;

public class Application {
public static void main(String[] args) {
// TODO: 프로그램 구현
}
Scanner sc = new Scanner(System.in);
//1.자동차 이름 입력하기
System.out.println("경주할 자동차 이름을 입력하세요.(이름은 쉽표(,) 기준으로 구분합니다.)");
String input = sc.nextLine();
String[] carNames = input.split(",");
Comment on lines +8 to +12
Copy link

Choose a reason for hiding this comment

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

기능 별로 클래스와 함수를 나눠주시는 게 좋을 것 같아요!


List<Car> cars = new Arraylist<>()
;
//2.시도 횟수
System.out.println("시도할 횟수는 몇회인가요?");
int attempts = sc.nextInt();
if (attempts <= 0) {

}
Comment on lines +19 to +21
Copy link

Choose a reason for hiding this comment

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

이런 경우일때는 throw new IllegalArgumentException("시도 횟수에 음수가 들어올 수 없습니다."); 와 같이 작성해주시면 될 것 같아요.

//3.경주 실행
System.out.println("실행 결과");
for (int i = 0; i < attempts; ++) {
Copy link

Choose a reason for hiding this comment

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

증감식 부분에 ++ 연산자만 들어와있어요!

Suggested change
for (int i = 0; i < attempts; ++) {
for (int i = 0; i < attempts; i++) {

for
}
//4.우승자
System.out.println("최종 우승자 :");
}


}