Skip to content
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
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

sobaman
Copy link

@sobaman sobaman commented Oct 28, 2024

No description provided.

- 들어온 문자열을 (,) 쉼표로 구분
- 각 자동차 이름의 길이가 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant