Skip to content

Conversation

@taco-recipe
Copy link

@taco-recipe taco-recipe commented Nov 3, 2025

구현 내용 요약

  1. 로또를 발행하고 당첨 로직을 MVC로 아키텍쳐를 설계하고 컨트롤러에서 전체 흐름을 실행
  2. 로또 모델이 1~45 범위의 중복 없는 6개 번호만 유지하도록 검증
  3. 당첨 통계와 수익률을 지정형식으로 출력
  4. 사용자 입력에 대한 검증을 강화해 잘못된 값에 대한 [ERROR] 오류 메세지 출력 및 재입력 흐름 구성
  5. LottoTest에 입력 검증과 같은 테스트케이스를 추가 구성해 테스트 진행

UML 클래스 다이어그램

classDiagram
    class Application {
        +main(String[] args)
    }
    class LottoController {
        +run()
        -readPurchaseAmount() int
        -createLottos(int) List<Lotto>
        -readWinningNumbers() Lotto
        -readBonusNumber(Lotto) int
        -LottoLogic(List<Lotto>, Lotto, int, int) LottoResult
        -countMatches(Lotto, Lotto) int
        -calculateProfitRate(int, int) double
    }
    class InputView {
        +purchasePrice() int
        +winningNumbers() Lotto
        +bonusNumber() int
    }
    class OutputView {
        +printError(String)
        +Lottos(List<Lotto>)
        +printLottoResult(LottoResult)
    }
    class Lotto {
        -numbers : List<Integer>
        +RandomLotto()
        +addNumber(int)
        +getNumber(int) int
        +contains(int) boolean
        +getNumbers() List<Integer>
    }
    class Rank {
        +getReward() int
        +valueOf(int) Rank
    }
    class LottoResult {
        +first : int
        +second : int
        +third : int
        +fourth : int
        +fifth : int
        +returnValue : double
    }

    Application ..> LottoController : run()
    LottoController ..> InputView : 입력
    LottoController ..> OutputView : 출력
    LottoController ..> Lotto : 로또 발행 및 비교
    LottoController ..> Rank : 상금 계산
    LottoController ..> LottoResult : 결과 생성
Loading

mvc 구조를 기반으로 controller, model, view 패키지 생성
구현할 기능 목록을 README.md에 정리
로또를 자동 발급과 수동 입력을 지원하고 번호를 오름차순 정렬해 일관된 출력 보장
등수별 상금 enum을 제공하고 당첨 결과를 관리하기 위한 LottoResult 추가
금액/번호 입력을 검증해 [ERROR] 메세지 출력 및 재입력, 구매 로또 목록과 당첨 통께 포멧 출력 구성
예외 발생시 반복 입력 처리를 진행하고 로또 운영 로직을 통해 당첨 결과와 수익률 계산등을 구현
개수, 범위, 중복 예외 케이스 확인 및 테스트 진행
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