-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[자동차 경주] 곽영규 미션 제출합니다. #1468
Open
sobaman
wants to merge
15
commits into
woowacourse-precourse:main
Choose a base branch
from
sobaman:sobaman
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[자동차 경주] 곽영규 미션 제출합니다. #1468
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 들어온 문자열을 (,) 쉼표로 구분 - 각 자동차 이름의 길이가 5를 넘을 경우 IllegalArgumentException 발생 - 자동차 이름이 중복일 경우 IllegalArgumentException 발생 - Map 에 각 자동차의 이름을 세팅, 전진 횟수를 0으로 세팅
- Car 객체에 자동차의 이름을 뜻하는 name, 전진 횟수를 뜻하는 forward 필드 구현 - Car 객체의 초기화 메서드와 get 메서드 구현 - 정적 팩토리 메서드를 사용해 Car 객체를 생성하게끔 구현 - 전진 횟수를 변화시키는 move 메서드 구현 - 자동차 이름이 5글자를 초과하면 IllegalArgumentException 발생
…, RacingManager 클래스를 새로 생성하고 inputCars 를 registerCars 로 새로 구현 - 구분자 쉼표(,)를 통해 carNames 를 분리 - 자동차 이름이 중복이 되는 경우를 검증하는 로직 구현 - List<Car> 형식으로 이름들을 저장
- Randoms.pickNumberInRange() 를 사용해 랜덤한 수를 추출하고 4가 넘어야만 전진 로직 작동
- 우승자는 다수일 수 있으므로, 가장 높은 전진 수를 기록한 car 를 추출해 List 에 저장 이후 출력
… 것, 해당 부분 수정 - "-" 는 상수 FORWARD_MARK 로 선언 - 저장된 전진 수 만큼 FORWARD_MARK 를 반복 출력하는 getForwardMark 기능 추가
… "-" 를 추가하는 것, 해당 부분 수정 - 자동차 이름과 전진 횟수를 출력 하는 부분 -> "-" 개수 를 출력하게끔 수정
- RacingCarLauncher 의 사용 영역과 설정 영역 분리에 초점 - 기능이 단순한 점을 고려해 향후 확장에 편리하도록 간단하게 설계
- registerCars(), race(), presentWinner() 가 원하는대로 동작하는지 통합 테스트
- AppConfig를 통해 RacingCarLauncher 인스턴스를 생성하고, 레이싱 시작 메서드를 호출
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.