Code Monkey home page Code Monkey logo

be-java-lotto's Introduction

Java Lotto

  • Last Update: 2022-01-06

2개의 메인 메소드가 존재하고 있습니다.
Console 프로그램을 위해서는 ConsoleLottoGame의 main 함수를 실행해 주세요.
Visual 프로그램을 위해서는 VisualLottoGame의 main 함수를 실행해 주세요.

코드 리뷰어를 위한 간략한 프로젝트 구조 설명

codesquad
 ├── ConsoleLottoGame.java
 ├── VisualLottoGame.java
 ├── Exceptions
 │   └── CustomException.java
 ├── InputManager
 │   ├── AwtInputHandler.java
 │   ├── UserInputHandler.java
 │   └── ScannerInputHandler.java
 ├── Lotto
 │   ├── Lotto.java
 │   ├── LottoStat.java
 │   ├── Prize.java
 │   └── WinLotto.java
 ├── UI
 │   ├── Panels
 │   │   ├── CustomPanel.java
 │   │   ├── ResultShowPanel.java
 │   │   ├── SingleInputPanel.java
 │   │   └── WinNumberPanel.java
 │   └── WindowManager.java
 └── Utility.java


워킹 디렉토리

  • ConsoleLottoGame : console 로또 게임을 실행하고, 로또 스텟에게 계산 수행을 시키는 메인 클래스
  • VisualLottoGame : visual 로또 게임을 실행하고, 각각의 버튼에 대응하는 event로직이 있는 메인 클레스
  • Utility : Validation check를 위한 모든 코드를 모은 class

Exceptions : 에러 클래스들은 담아두는 패키지

  • CustomException - 에러 메세지를 보여주고, 죽을때 왜 죽었는지 표시하기 위한 Exception class

InputManage : 입력을 handling 하는 패키지

  • UserInputHandler : 사용자 입력을 받기 위한 Interface
    • 사용자에게 입력받는 방법은 scanner, bufferedReader, streamReader 등등 다양함 그에 interface 사용
  • ScannerInputHandler : UserInputHandler 구현체
    • java.util.Scanner 이용해서 구현을 진행함
  • AwtInputHandler: UserInputHandler 구현체
    • 각 화면의 Button, Label, TextField 등등을 이용해 구현함

Lotto : 로또 관련 기능들을 담당하는 패키지

  • Lotto : 한장의 로또
  • LottoStat : 로또들을 관리해서 통계를 뽑는 클래스
  • Prize : 로또의 상금을 저장하고 있는 Enum
  • WinLotto : 당첨번호와 보너스 번호를 가지고 있는 클래스

UI : awt를 이용해 화면을 보여주기위한 클래스를 모아둔 패키지

  • WindowsManager : 하나의창을 의미하며 여기서 판넬을 바꿔끼어 화면이 바뀜.
  • Panels : 각 화면을 구성하기 위한 판넬들을 모아둔 패키지
    • CustomPanel : interface 클래스로 WindowManager가 판낼을 관리하기 위한 기본 인터페이스
    • ResultShowPanel : 결과화면을 보여주는 판넬로 텍스트 필드와 버튼만 존재.
    • SingleInputPanel : 하나의 입력창이 있는 판넬
    • WinNumberPanel : 하나의 긴 입력창과 하나의 짧은 입력창이 있는 판넬

코드 리뷰

be-java-lotto's People

Contributors

rohsik2 avatar javajigi avatar honux77 avatar

be-java-lotto's Issues

Code Review from DevRoad

{/src/main/java/kr/codesquad/UI/Panels/WinNumberPanel.java=

This code creates a WinNumberPanel, which is a custom panel used to display a text field and a button for entering a winning number. The code also sets up the elements of the panel, such as labels, text fields, and buttons, and adds an action listener to the button. Finally, the code creates an input handler for the text field and bonus field, which is used to validate user input., /src/main/java/kr/codesquad/UI/Panels/SingleInputPanel.java=, /src/main/java/kr/codesquad/ConsoleLottoGame.java=

This code is a console-based lotto game. It allows the user to buy lotto tickets, get the winning numbers, and print the results. The user can buy lotto tickets either manually or automatically. The code also includes a UserInputHandler class which handles user input and a LottoStat class which calculates the results of the lotto game., /src/main/java/kr/codesquad/InputManager/UserInputHandler.java=

This code is an interface for a UserInputHandler, which is responsible for handling user input. It provides methods for getting money, a list of six lotto numbers, a bonus number, and the amount of manual lotto tickets., /src/main/java/kr/codesquad/UI/Panels/ResultShowPanel.java=

This code creates a ResultShowPanel, which is a custom panel used to display a message to the user. It takes in two strings as parameters, an instruction string and a message string, and an ActionListener object. The panel contains a label with the instruction string, a text area with the message string, and a button with the action listener. The panel is set to a size of 400x360 and has a null layout. The elements of the panel are set using the setE, /src/main/java/kr/codesquad/Exceptions/CustomException.java=

This code creates a custom exception class that extends the IllegalArgumentException class. When an instance of this class is created, it prints out an error message with the message passed in as an argument., /src/main/java/kr/codesquad/UI/Panels/CustomPanel.java=

This code defines an abstract class called CustomPanel which extends the Panel class. The CustomPanel class provides an abstract method called getUserInputHandler() which can be used to get an instance of the UserInputHandler class. This allows developers to create custom panels that can handle user input in a specific way., /src/main/java/kr/codesquad/Utility.java=

This code provides utility functions for generating random six numbers, checking for duplicates, parsing integers with a range, and converting strings to integer lists with a range., /src/main/java/kr/codesquad/InputManager/ScannerInputHandler.java=

This code is a ScannerInputHandler class which implements the UserInputHandler interface. It provides methods for getting user input from the console using a Scanner object. The methods include getting the purchase amount, the winning lottery numbers, the bonus number, and the amount of manual lottery tickets to purchase., /src/main/java/kr/codesquad/Lotto/WinLotto.java=

This code is a class that represents a winning lottery ticket. It extends the Lotto class and adds an additional field for the bonus number. It has a constructor that takes a list of winning numbers and the bonus number as parameters, and a getter method for the bonus number., /src/main/java/kr/codesquad/VisualLottoGame.java=

This code is for a visual lotto game. It allows the user to purchase lotto tickets, enter the winning numbers, and then displays the results of the lotto draw. The code includes a WindowManager class which handles the user interface, a Lotto class which stores the lotto numbers, a WinLotto class which stores the winning lotto numbers, and a LottoStat class which calculates the results of the lotto draw., /src/main/java/kr/codesquad/Lotto/Lotto.java=

이 코드는 로또 게임을 위한 클래스를 생성합니다. 로또 객체는 6개의 랜덤한 숫자로 , /src/main/java/kr/codesquad/Lotto/LottoStat.java=

This code is a class that calculates the statistics of a lottery game. It takes a list of Lotto objects and a WinLotto object as parameters and calculates the total money won, the number of wins for each prize, and the return on investment (ROI). It then prints out the results in a formatted string., /src/main/java/kr/codesquad/Lotto/Prize.java=

This code defines an enum called Prize, which contains the different prizes that can be won in a lottery. It also contains a static method called calcPrize(), which takes two parameters (a WinLotto object and a Lotto object) and returns the corresponding Prize enum value based on the number of matching numbers between the two objects., /src/main/java/kr/codesquad/InputManager/AwtInputHandler.java=

This code is a part of an InputManager class that handles user input from an AWT TextField and Label. It provides methods to get user input such as money, six lotto numbers, bonus number, and manual lotto amount. It also checks for valid input and throws an exception if the input is invalid., /src/main/java/kr/codesquad/UI/WindowManager.java=

This code is a WindowManager class that is used to manage the user interface of a lotto simulator. It provides methods to set different panels for the user to interact with, such as a panel to enter the amount of money to purchase lotto tickets, a panel to enter the number of manual lotto tickets to purchase, a panel to enter the numbers for a single manual lotto ticket, a panel to show the purchased lotto tickets, a panel to enter the winning lotto numbers}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.