Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
feat : 자동차 이름 입력
feat : 이름 글자 5글자 이상시 오류 발생
feat : 시도할 횟수 입력
feat : 0~9중에서 랜덤한 정수 생성

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

따로 적은 이유가 있을까요?

37 changes: 37 additions & 0 deletions src/test/java/racingcar/ApplicationTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package racingcar;

import camp.nextstep.edu.missionutils.Randoms;
import camp.nextstep.edu.missionutils.test.NsTest;
import org.junit.jupiter.api.Test;
import java.util.Scanner;

import static camp.nextstep.edu.missionutils.test.Assertions.assertRandomNumberInRangeTest;
import static camp.nextstep.edu.missionutils.test.Assertions.assertSimpleTest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.assertj.core.api.InstanceOfAssertFactories.ARRAY;

class ApplicationTest extends NsTest {
private static final int MOVING_FORWARD = 4;
Expand All @@ -31,8 +34,42 @@ class ApplicationTest extends NsTest {
);
}

public class Random{

}
@Override
public void runMain() {
Scanner sc = new Scanner(System.in);
//System.out.println("경주할 자동차 이름을 입력하세요.");
String[] name = sc.next().split(",");
for(int k = 0; k < name.length; k++){
if(name[k].length() >= 5){
throw new IllegalArgumentException();
}
}
System.out.println("시도할 횟수는 몇번인가요?");
int input_num = sc.nextInt();
int[] name_add = new int[name.length];
int[] ans = new int[name.length];
for(int i = 0; i < input_num; i++) {
int[] arr_num = new int[name.length];
for(int j= 0; j < name.length; j++) {
arr_num[j] = Randoms.pickNumberInRange(0, 9);
if (arr_num[j] >= 4) {
ans[j] += 1;
}
System.out.print(name[j] + " : ");
for (int k=0;k<ans[j];k++) {
System.out.print("-");
}
System.out.println();
}
System.out.println();
}
for (int max = 0; max < name.length; max++) {

}
Application.main(new String[]{});

Comment on lines +37 to +44

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

이건 삭제하셔도 됩니다.

}
}