-
Notifications
You must be signed in to change notification settings - Fork 190
[로또] 장예훈 미션 제출합니다. #181
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
Open
JangYEhoon00
wants to merge
31
commits into
woowacourse-precourse:main
Choose a base branch
from
JangYEhoon00:calculator
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
[로또] 장예훈 미션 제출합니다. #181
Conversation
This file contains hidden or 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
로또 번호 입력하는 기능이 필요없는것으로 판단해서 제거하였습니다
시행횟수를 받는 부분에서 금액을 입력하라고 있던 오타를 기능에 맞게 수정하였습니다.
시행횟수가 0이거나 0보다 작을경우 예외처리를 했습니다. 추가적으로 게임 금액이 투입 금액보다 클 경우 예외처리 했습니다
에러 메세지를 상수화 시켜서 에러 메세지를 더 간소하고 수정을 더 용이하게할 수 있도록 정리했습니다
변경된 내용을 리드미 파일에 반영하였습니다
입력받은 금액과 게임하는게 필요한 금액을 계산하여 최대로 가능한 게임 횟수를 알려줍니다
해당 객체의 생성자로 이미 금액을 입력받기 때문에 따로 파라미터를 받는게 아닌 해당 객체의 값을 그대로 가져오는 방식을 선택했습니다
요구사항에 따라 구매 가능 금액을 입력받습니다
게임 구매 입력에 따른 거스름돈 반환함수 (restMoney) 수정
등수에 맞게 나오는 안내메세지를 상수화 시켰습니다
좀더 안전성을 확보하기 위해 객체를 통한 상수화를 거쳐 매직넘버를 표현했습니다
랜덤으로 생성한 번호를 정렬시키고 정렬시킨 값과 입력값을 비교하는 기능을 구현했습니다
pc에서 작업하기위한 PR
로또 클래스에서 너무 많은 책임을 가지고 있는것 같아 따로 클래스를 분리했습니다
mvc패턴에 맞게 데이터의 흐름을 변경했습니다 또한 위반가능성이 있는 부분은 클래스를 새롭게 만들어서 처리했습니다
generateTicket 함수가 단일 책임을 위반하여 따로 메서드를 분리했습니다
안전한 정보의 전달을 위해 게터함수의 리컨값을 스프레드 연산자를 통해 복사하였습니다.
등수를 구별하기 위해서 불린값을 가지는 배열을 리턴하는 메서드를 구햔하였습니다
배열에 입력값에 맞게 등수를 확인시키는 기능을 추가하였습니다
테스트 코드가 요구하는 사항에 맞게 코드를 수정하였습니다 잘못된 참조 수정 및 잘못된 유틸리티 호출 수정, money 생성자 파라미터 1개로 변경
계산 기능의 테스트 코드를 작성하였습니다
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.
javascript-lotto-precourse
프리코스-로또
이번 미션에서는 도전하고 싶은 부분
1. 모델 (Model): 데이터 관리의 핵심
2. 뷰 (View): 사용자 인터페이스 담당
app/views폴더에 있는 파일 (예:users/index.html.erb,posts/show.html.erb)뷰를 쉽게 이해하는 방법:
3. 컨트롤러 (Controller): 모델과 뷰 연결 담당
app/controllers폴더에 있는 파일 (예:UsersController.rb,PostsController.rb)컨트롤러를 쉽게 이해하는 방법:
미션에 따른 역할 구분
중복되지 않는 6개의 숫자는 화면에 보여주는 역할만 담당하므로 뷰에 해당
화면에 보여주는 역할만 담당하므로 뷰에 해당
등수에 대한 데이터는 상수화 번호를 확인한 다음 일치하는 번호에 따른 값을 출력
입력된 값에 따라 데이터를 뷰로 보내기 때문에 있으므로 컨트롤러에 해당
이건 상수로 묶어서 처리
입력된 값에 따라 데이터를 뷰로 보내기 때문에 있으므로 컨트롤러에 해당
Error를 발생시키고 해당 메시지를 출력한 다음 해당 지점부터 다시 입력을 받는다.Money 클래스에서 해야할일
Lotto 클래스 해야할일
LottoGenerator 클래스의 역할
Calculator 클래스의 역할