diff --git a/README.md b/README.md
index 81b03cdba2..208116daa2 100644
--- a/README.md
+++ b/README.md
@@ -1,207 +1,63 @@
-# ๊ณผ์ - ๋ก๋
+# Lotto
-## ๐ ์งํ ๋ฐฉ์
+1. Lotto ์ํ์ ๋ณต์ฌํด์จ๋ค.
+2. ์ฐ์น ๋ณต๊ถ๊ณผ ๋น๊ตํ์ฌ ๋ช๊ฐ์ ์ซ์๊ฐ ๋ง์๋์ง ํ์ธํ๋ ๋ก์ง์ ๋ง๋ ๋ค.
+3. ๋ณด๋์ค๊ฐ ์ผ์นํ๋์ง๋ฅผ ํ์ธํ๋ ๋ก์ง์ ๋ง๋ ๋ค.
+4. Lotto์ ๊ฐ์ ์ถ๋ ฅํ๋ ๋ก์ง์ ๊ตฌํ.
-- ๊ณผ์ ๋ **๊ธฐ๋ฅ ์๊ตฌ ์ฌํญ, ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ ์ฌํญ, ๊ณผ์ ์งํ ์๊ตฌ ์ฌํญ** ์ธ ๊ฐ์ง๋ก ๊ตฌ์ฑ๋์ด ์๋ค.
-- ์ธ ๊ฐ์ ์๊ตฌ ์ฌํญ์ ๋ง์กฑํ๊ธฐ ์ํด ๋
ธ๋ ฅํ๋ค. ํนํ ๊ธฐ๋ฅ์ ๊ตฌํํ๊ธฐ ์ ์ ๊ธฐ๋ฅ ๋ชฉ๋ก์ ๋ง๋ค๊ณ , ๊ธฐ๋ฅ ๋จ์๋ก ์ปค๋ฐ ํ๋ ๋ฐฉ์์ผ๋ก ์งํํ๋ค.
-- ๊ธฐ๋ฅ ์๊ตฌ ์ฌํญ์ ๊ธฐ์ฌ๋์ง ์์ ๋ด์ฉ์ ์ค์ค๋ก ํ๋จํ์ฌ ๊ตฌํํ๋ค.
+# WinningLotto
----
+1. ์ฐ์น ๋ณต๊ถ์ ์ ๋ณด๋ฅผ ์ ์ฅํ๋ค.
+2. ์ฌ๊ธฐ์ Lotto์ ๊ฐ์ฒด์, bonus ์ ๋ณด๋ฅผ ์ ์ฅํ๋ค.
-## ๐ ๊ณผ์ ์งํ ๋ฐ ์ ์ถ ๋ฐฉ๋ฒ
+# ENUM
-- ๊ณผ์ ๋ [java-lotto](https://github.com/LandvibeDev/java-lotto) ์ ์ฅ์๋ฅผ Fork/Cloneํด ์์ํ๋ค.
-- **๊ธฐ๋ฅ์ ๊ตฌํํ๊ธฐ ์ ์ java-baseball-precourse/README.md ํ์ผ์ ๊ตฌํํ ๊ธฐ๋ฅ ๋ชฉ๋ก์ ์ ๋ฆฌ**ํด ์ถ๊ฐํ๋ค.
-- **Git์ ์ปค๋ฐ ๋จ์๋ ์ ๋จ๊ณ์์ README.md ํ์ผ์ ์ ๋ฆฌํ ๊ธฐ๋ฅ ๋ชฉ๋ก ๋จ์**๋ก ์ถ๊ฐํ๋ค.
- - [AngularJS Commit Message Conventions](https://gist.github.com/stephenparish/9941e89d80e2bc58a153) ์ฐธ๊ณ ํด commit log๋ฅผ ๋จ๊ธด๋ค.
-- ๊ณผ์ ์งํ ๋ฐ ์ ์ถ ๋ฐฉ๋ฒ์ [์ฐ์ํ์ฝ์ค ๊ณผ์ ์ ์ถ ๋ฌธ์](https://github.com/woowacourse/woowacourse-docs/tree/master/precourse) ๋ฅผ ์ฐธ๊ณ ํ๋ค.
- - base repository๋ฅผ `LandvibeDev/java-lotto`๋ก ์ง์ ํด์ PR ์์ฑํ๋ฉด๋จ
+1. Lotto์ ๋ํ ์์๊ฐ๋ค์ ์ ์ํ๋ class RandomRange ์์ฑ
+2. ์๊ธ์ ๋ํ ์์๊ฐ๋ค์ ์ ์ํ๋ class Prize ์์ฑ
-
+# CheckException
-### ํ
์คํธ ์คํ ๊ฐ์ด๋
+1. winningLotto๋ฅผ ์
๋ ฅ๋ฐ์๋, ์๋ชป ๋ฐ๋์ง ํ์ธํ๊ธฐ์ํ ์ธํฐํ์ด์ค
-- ํฐ๋ฏธ๋์์ `java -version`์ ์คํํ์ฌ Java ๋ฒ์ ์ด 14์ธ์ง ํ์ธํ๋ค. ๋๋ Eclipse ๋๋ IntelliJ IDEA์ ๊ฐ์ IDE์์ Java 14๋ก ์คํ๋๋์ง ํ์ธํ๋ค.
-- ํฐ๋ฏธ๋์์ Mac ๋๋ Linux ์ฌ์ฉ์์ ๊ฒฝ์ฐ `./gradlew clean test` ๋ช
๋ น์ ์คํ ํ๊ณ ,
- Windows ์ฌ์ฉ์์ ๊ฒฝ์ฐ `gradlew.bat clean test` ๋ช
๋ น์ ์คํํ ๋ ๋์ ํ๋์ง ๋ง ํ์ธ(ํ
์คํธ๋ ์คํจ).
+# CheckExceptionImpl
----
+1. CheckException์ธํฐํ์ด์ค๋ฅผ ๊ตฌํํ ํด๋์ค
-## ๐ ๊ธฐ๋ฅ ์๊ตฌ ์ฌํญ
+# BuyMoney
-๋ก๋ ๊ฒ์ ๊ธฐ๋ฅ์ ๊ตฌํํด์ผ ํ๋ค. ๋ก๋ ๊ฒ์์ ์๋์ ๊ฐ์ ๊ท์น์ผ๋ก ์งํ๋๋ค.
+1. ๊ตฌ๋งค ๊ธ์ก์ ์
๋ ฅ๋ฐ๊ณ , ํ์์ ๊ฒ์ฆํ๋ค.
+2. ๊ธ์ก์ด ์
๋ ฅ๋๋ฉด ๊ธ์ก์ผ๋ก ๋ช์ฅ์ ๊ตฌ๋งคํ๋์ง ์ถ๋ ฅํ๋ค.
-```
-- ๋ก๋ ๋ฒํธ์ ์ซ์ ๋ฒ์๋ 1~45๊น์ง์ด๋ค.
-- 1๊ฐ์ ๋ก๋๋ฅผ ๋ฐํํ ๋ ์ค๋ณต๋์ง ์๋ 6๊ฐ์ ์ซ์๋ฅผ ๋ฝ๋๋ค.
-- ๋น์ฒจ ๋ฒํธ ์ถ์ฒจ ์ ์ค๋ณต๋์ง ์๋ ์ซ์ 6๊ฐ์ ๋ณด๋์ค ๋ฒํธ 1๊ฐ๋ฅผ ๋ฝ๋๋ค.
-- ๋น์ฒจ์ 1๋ฑ๋ถํฐ 5๋ฑ๊น์ง ์๋ค. ๋น์ฒจ ๊ธฐ์ค๊ณผ ๊ธ์ก์ ์๋์ ๊ฐ๋ค.
- - 1๋ฑ: 6๊ฐ ๋ฒํธ ์ผ์น / 2,000,000,000์
- - 2๋ฑ: 5๊ฐ ๋ฒํธ + ๋ณด๋์ค ๋ฒํธ ์ผ์น / 30,000,000์
- - 3๋ฑ: 5๊ฐ ๋ฒํธ ์ผ์น / 1,500,000์
- - 4๋ฑ: 4๊ฐ ๋ฒํธ ์ผ์น / 50,000์
- - 5๋ฑ: 3๊ฐ ๋ฒํธ ์ผ์น / 5,000์
-```
+# InputWinningLotto
-- ๋ก๋ ๊ตฌ์
๊ธ์ก์ ์
๋ ฅํ๋ฉด ๊ตฌ์
๊ธ์ก์ ํด๋นํ๋ ๋งํผ ๋ก๋๋ฅผ ๋ฐํํด์ผ ํ๋ค.
-- ๋ก๋ 1์ฅ์ ๊ฐ๊ฒฉ์ 1,000์์ด๋ค.
-- ๋น์ฒจ ๋ฒํธ์ ๋ณด๋์ค ๋ฒํธ๋ฅผ ์
๋ ฅ๋ฐ๋๋ค.
-- ์ฌ์ฉ์๊ฐ ๊ตฌ๋งคํ ๋ก๋ ๋ฒํธ์ ๋น์ฒจ ๋ฒํธ๋ฅผ ๋น๊ตํ์ฌ ๋น์ฒจ ๋ด์ญ ๋ฐ ์์ต๋ฅ ์ ์ถ๋ ฅํ๊ณ ๋ก๋ ๊ฒ์์ ์ข
๋ฃํ๋ค.
-- ์ฌ์ฉ์๊ฐ ์๋ชป๋ ๊ฐ์ ์
๋ ฅํ ๊ฒฝ์ฐ `IllegalArgumentException`๋ฅผ ๋ฐ์์ํค๊ณ , "[ERROR]"๋ก ์์ํ๋ ์๋ฌ ๋ฉ์์ง๋ฅผ ์ถ๋ ฅ ํ ์ข
๋ฃํ๋ค.
+1. ์ฐ์น ๋ก๋๋ฅผ ์
๋ ฅ๋ฐ๋๋ค.
+2. CheckException์ผ๋ก ์ค๋ฅ๋ฅผ ํ์ธํ๋ค.
-## โ๐ป ์
์ถ๋ ฅ ์๊ตฌ์ฌํญ
+# Rank
+
+1. lotto์ win lotto๋ฅผ ์ ๋ฌ๋ฐ์์ ๋ช๊ฐ๊ฐ match์ธ์ง, bonus๊ฐ ๋ง์๋์ง๋ฅผ ํ์ธํ๋ค.
+
+## rankValue()
+
+1. 1~5๋ฑ๊น์ง ํด๋นํ๋ ํ์๋ฅผ ์ฆ๊ฐ์ํจ๋ค.
+
+# EarnMoney
+
+## addMoney()
+
+1. ๋น์ฒจ๋ ๊ธ์ก๋งํผ ํ์ฌ ์์ง๊ธ์ ์ฆ๊ฐ์ํจ๋ค.
+
+# PrintCorrectCount
+
+## print()
+
+1. ๊ฐ๊ฐ์ ๋ฑ์๋ณ๋ก ๋ชํ ๋น์ฒจ๋์๋์ง ์ถ๋ ฅํ๋ค.
+2. ์ด ์์ต๋ฅ ์ ์ถ๋ ฅํ๋ค.
+
+# Game, LottoGame
+1. Game์ ๋จ์ํ ์ธํฐํ์ด์ค
+2. LottoGame ์ Game์ ๊ตฌํ
+3. LottoGame์์ ๊ฒ์ ๋ก์ง ์งํ.
-### โจ๏ธ ์
๋ ฅ
-- ๋ก๋ ๊ตฌ์
๊ธ์ก์ ์
๋ ฅ ๋ฐ๋๋ค. ๊ตฌ์
๊ธ์ก์ 1,000์ ๋จ์๋ก ์
๋ ฅ ๋ฐ์ผ๋ฉฐ 1,000์์ผ๋ก ๋๋์ด ๋จ์ด์ง์ง ์๋ ๊ฒฝ์ฐ ์์ธ ์ฒ๋ฆฌํ๋ค.
-```
-14000
-```
-
-- ๋น์ฒจ ๋ฒํธ๋ฅผ ์
๋ ฅ ๋ฐ๋๋ค. ๋ฒํธ๋ ์ผํ(,)๋ฅผ ๊ธฐ์ค์ผ๋ก ๊ตฌ๋ถํ๋ค.
-
-```
-1,2,3,4,5,6
-```
-
-- ๋ณด๋์ค ๋ฒํธ๋ฅผ ์
๋ ฅ ๋ฐ๋๋ค.
-
-```
-7
-```
-
-### ๐ฅ ์ถ๋ ฅ
-
-- ๋ฐํํ ๋ก๋ ์๋ ๋ฐ ๋ฒํธ๋ฅผ ์ถ๋ ฅํ๋ค. ๋ก๋ ๋ฒํธ๋ ์ค๋ฆ์ฐจ์์ผ๋ก ์ ๋ ฌํ์ฌ ๋ณด์ฌ์ค๋ค.
-
-```
-8๊ฐ๋ฅผ ๊ตฌ๋งคํ์ต๋๋ค.
-[8, 21, 23, 41, 42, 43]
-[3, 5, 11, 16, 32, 38]
-[7, 11, 16, 35, 36, 44]
-[1, 8, 11, 31, 41, 42]
-[13, 14, 16, 38, 42, 45]
-[7, 11, 30, 40, 42, 43]
-[2, 13, 22, 32, 38, 45]
-[1, 3, 5, 14, 22, 45]
-```
-
-- ๋น์ฒจ ๋ด์ญ์ ์ถ๋ ฅํ๋ค.
-
-```
-3๊ฐ ์ผ์น (5,000์) - 1๊ฐ
-4๊ฐ ์ผ์น (50,000์) - 0๊ฐ
-5๊ฐ ์ผ์น (1,500,000์) - 0๊ฐ
-5๊ฐ ์ผ์น, ๋ณด๋์ค ๋ณผ ์ผ์น (30,000,000์) - 0๊ฐ
-6๊ฐ ์ผ์น (2,000,000,000์) - 0๊ฐ
-```
-
-- ์์ต๋ฅ ์ ์์์ ๋์งธ ์๋ฆฌ์์ ๋ฐ์ฌ๋ฆผํ๋ค. (ex. 100.0%, 51.5%, 1,000,000.0%)
-
-```
-์ด ์์ต๋ฅ ์ 62.5%์
๋๋ค.
-```
-
-- ์์ธ ์ํฉ ์ ์๋ฌ ๋ฌธ๊ตฌ๋ฅผ ์ถ๋ ฅํด์ผ ํ๋ค. ๋จ, ์๋ฌ ๋ฌธ๊ตฌ๋ "[ERROR]"๋ก ์์ํด์ผ ํ๋ค.
-
-```
-[ERROR] ๋ก๋ ๋ฒํธ๋ 1๋ถํฐ 45 ์ฌ์ด์ ์ซ์์ฌ์ผ ํฉ๋๋ค.
-```
-
-### ๐ป ์คํ ๊ฒฐ๊ณผ ์์
-
-```
-๊ตฌ์
๊ธ์ก์ ์
๋ ฅํด ์ฃผ์ธ์.
-8000
-
-8๊ฐ๋ฅผ ๊ตฌ๋งคํ์ต๋๋ค.
-[8, 21, 23, 41, 42, 43]
-[3, 5, 11, 16, 32, 38]
-[7, 11, 16, 35, 36, 44]
-[1, 8, 11, 31, 41, 42]
-[13, 14, 16, 38, 42, 45]
-[7, 11, 30, 40, 42, 43]
-[2, 13, 22, 32, 38, 45]
-[1, 3, 5, 14, 22, 45]
-
-๋น์ฒจ ๋ฒํธ๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.
-1,2,3,4,5,6
-
-๋ณด๋์ค ๋ฒํธ๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.
-7
-
-๋น์ฒจ ํต๊ณ
----
-3๊ฐ ์ผ์น (5,000์) - 1๊ฐ
-4๊ฐ ์ผ์น (50,000์) - 0๊ฐ
-5๊ฐ ์ผ์น (1,500,000์) - 0๊ฐ
-5๊ฐ ์ผ์น, ๋ณด๋์ค ๋ณผ ์ผ์น (30,000,000์) - 0๊ฐ
-6๊ฐ ์ผ์น (2,000,000,000์) - 0๊ฐ
-์ด ์์ต๋ฅ ์ 62.5%์
๋๋ค.
-```
-
----
-
-## ๐ฏ ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ ์ฌํญ
-
-- JDK 14 ๋ฒ์ ์์ ์คํ ๊ฐ๋ฅํด์ผ ํ๋ค.
-- ํ๋ก๊ทธ๋จ ์คํ์ ์์์ ์ `Application`์ `main()`์ด๋ค.
-- `build.gradle` ํ์ผ์ ๋ณ๊ฒฝํ ์ ์๊ณ , ์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ง ์๋๋ค.
-- [Java ์ฝ๋ ์ปจ๋ฒค์
](https://naver.github.io/hackday-conventions-java/) ๊ฐ์ด๋๋ฅผ ์ค์ํ๋ฉฐ ํ๋ก๊ทธ๋๋ฐํ๋ค.
-- ํ๋ก๊ทธ๋จ ์ข
๋ฃ ์ `System.exit()`๋ฅผ ํธ์ถํ์ง ์๋๋ค.
-- ํ๋ก๊ทธ๋จ ๊ตฌํ์ด ์๋ฃ๋๋ฉด `ApplicationTest`์ ๋ชจ๋ ํ
์คํธ๊ฐ ์ฑ๊ณตํด์ผ ํ๋ค.
-- ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ ์ฌํญ์์ ๋ฌ๋ฆฌ ๋ช
์ํ์ง ์๋ ํ ํ์ผ, ํจํค์ง ์ด๋ฆ์ ์์ ํ๊ฑฐ๋ ์ด๋ํ์ง ์๋๋ค.
-- indent(์ธ๋ดํธ, ๋ค์ฌ์ฐ๊ธฐ) depth๋ฅผ 3์ด ๋์ง ์๋๋ก ๊ตฌํํ๋ค. 2๊น์ง๋ง ํ์ฉํ๋ค.
- - ์๋ฅผ ๋ค์ด while๋ฌธ ์์ if๋ฌธ์ด ์์ผ๋ฉด ๋ค์ฌ์ฐ๊ธฐ๋ 2์ด๋ค.
- - ํํธ: indent(์ธ๋ดํธ, ๋ค์ฌ์ฐ๊ธฐ) depth๋ฅผ ์ค์ด๋ ์ข์ ๋ฐฉ๋ฒ์ ํจ์(๋๋ ๋ฉ์๋)๋ฅผ ๋ถ๋ฆฌํ๋ฉด ๋๋ค.
-- 3ํญ ์ฐ์ฐ์๋ฅผ ์ฐ์ง ์๋๋ค.
-- ํจ์(๋๋ ๋ฉ์๋)๊ฐ ํ ๊ฐ์ง ์ผ๋ง ํ๋๋ก ์ต๋ํ ์๊ฒ ๋ง๋ค์ด๋ผ.
-- JUnit 5์ AssertJ๋ฅผ ์ด์ฉํ์ฌ ๋ณธ์ธ์ด ์ ๋ฆฌํ ๊ธฐ๋ฅ ๋ชฉ๋ก์ด ์ ์ ๋์ํจ์ ํ
์คํธ ์ฝ๋๋ก ํ์ธํ๋ค.
-- ํจ์(๋๋ ๋ฉ์๋)์ ๊ธธ์ด๊ฐ 15๋ผ์ธ์ ๋์ด๊ฐ์ง ์๋๋ก ๊ตฌํํ๋ค.
- - ํจ์(๋๋ ๋ฉ์๋)๊ฐ ํ ๊ฐ์ง ์ผ๋ง ์ ํ๋๋ก ๊ตฌํํ๋ค.
-- else ์์ฝ์ด๋ฅผ ์ฐ์ง ์๋๋ค.
- - ํํธ: if ์กฐ๊ฑด์ ์์ ๊ฐ์ returnํ๋ ๋ฐฉ์์ผ๋ก ๊ตฌํํ๋ฉด else๋ฅผ ์ฌ์ฉํ์ง ์์๋ ๋๋ค.
- - else๋ฅผ ์ฐ์ง ๋ง๋ผ๊ณ ํ๋ switch/case๋ก ๊ตฌํํ๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ฐ switch/case๋ ํ์ฉํ์ง ์๋๋ค.
-- Java Enum์ ์ ์ฉํ๋ค.
-- ๋๋ฉ์ธ ๋ก์ง์ ๋จ์ ํ
์คํธ๋ฅผ ๊ตฌํํด์ผ ํ๋ค. ๋จ, UI(System.out, System.in, Scanner) ๋ก์ง์ ์ ์ธํ๋ค.
- - ํต์ฌ ๋ก์ง์ ๊ตฌํํ๋ ์ฝ๋์ UI๋ฅผ ๋ด๋นํ๋ ๋ก์ง์ ๋ถ๋ฆฌํด ๊ตฌํํ๋ค.
-
-### ๋ผ์ด๋ธ๋ฌ๋ฆฌ
-
-- [`camp.nextstep.edu.missionutils`](https://github.com/woowacourse-projects/mission-utils)์์ ์ ๊ณตํ๋ `Randoms` ๋ฐ `Console` API๋ฅผ ์ฌ์ฉํ์ฌ ๊ตฌํํด์ผ ํ๋ค.
- - Random ๊ฐ ์ถ์ถ์ `camp.nextstep.edu.missionutils.Randoms`์ `pickUniqueNumbersInRange()`๋ฅผ ํ์ฉํ๋ค.
- - ์ฌ์ฉ์๊ฐ ์
๋ ฅํ๋ ๊ฐ์ `camp.nextstep.edu.missionutils.Console`์ `readLine()`์ ํ์ฉํ๋ค.
-
-#### ์ฌ์ฉ ์์
-
-```java
-List numbers = Randoms.pickUniqueNumbersInRange(1, 45, 6);
-```
-
-### Lotto ํด๋์ค
-
-- ์ ๊ณต๋ `Lotto` ํด๋์ค๋ฅผ ํ์ฉํด ๊ตฌํํด์ผ ํ๋ค.
-- `Lotto`์ ๋งค๊ฐ ๋ณ์๊ฐ ์๋ ์์ฑ์๋ฅผ ์ถ๊ฐํ ์ ์๋ค.
-- `numbers`์ ์ ๊ทผ ์ ์ด์์ธ private์ ๋ณ๊ฒฝํ ์ ์๋ค.
-- `Lotto`์ ํ๋(์ธ์คํด์ค ๋ณ์)๋ฅผ ์ถ๊ฐํ ์ ์๋ค.
-- `Lotto`์ ํจํค์ง ๋ณ๊ฒฝ์ ๊ฐ๋ฅํ๋ค.
-
-```java
-public class Lotto {
- private final List numbers;
-
- public Lotto(List numbers) {
- validate(numbers);
- this.numbers = numbers;
- }
-
- private void validate(List numbers) {
- if (numbers.size() != 6) {
- throw new IllegalArgumentException();
- }
- }
-
- // TODO: ์ถ๊ฐ ๊ธฐ๋ฅ ๊ตฌํ
-}
-```
diff --git a/src/main/java/lotto/Application.java b/src/main/java/lotto/Application.java
index 367ee30584..f39a21e1fc 100644
--- a/src/main/java/lotto/Application.java
+++ b/src/main/java/lotto/Application.java
@@ -1,7 +1,12 @@
package lotto;
+import lotto.game.Game;
+import lotto.game.LottoGame;
+
public class Application {
public static void main(String[] args) {
// TODO: ํ๋ก๊ทธ๋จ ๊ตฌํ
+ Game lottoGame = new LottoGame();
+ lottoGame.play();
}
}
\ No newline at end of file
diff --git a/src/main/java/lotto/checkexception/CheckCharException.java b/src/main/java/lotto/checkexception/CheckCharException.java
new file mode 100644
index 0000000000..59d27d8254
--- /dev/null
+++ b/src/main/java/lotto/checkexception/CheckCharException.java
@@ -0,0 +1,12 @@
+package lotto.checkexception;
+
+public class CheckCharException {
+ public void checkCharException(String input){
+ for(int i = 0; i < input.length(); i++){
+ if(input.charAt(i) >= '0' && input.charAt(i) <= '9'){
+ continue;
+ }
+ throw new IllegalArgumentException("[ERROR]์ซ์๋ง ์
๋ ฅํ์ธ์.");
+ }
+ }
+}
diff --git a/src/main/java/lotto/checkexception/CheckException.java b/src/main/java/lotto/checkexception/CheckException.java
new file mode 100644
index 0000000000..6cf946da14
--- /dev/null
+++ b/src/main/java/lotto/checkexception/CheckException.java
@@ -0,0 +1,5 @@
+package lotto.checkexception;
+
+public interface CheckException {
+ void checkException(int check);
+}
diff --git a/src/main/java/lotto/checkexception/CheckExceptionImpl.java b/src/main/java/lotto/checkexception/CheckExceptionImpl.java
new file mode 100644
index 0000000000..9eb8a033a4
--- /dev/null
+++ b/src/main/java/lotto/checkexception/CheckExceptionImpl.java
@@ -0,0 +1,12 @@
+package lotto.checkexception;
+
+import lotto.numbers.RandomRange;
+
+public class CheckExceptionImpl implements CheckException{
+ public void checkException(int check) {
+ if (check > RandomRange.MAX_VALUE.getValue() || check < RandomRange.MIN_VALUE.getValue()) {
+ throw new IllegalArgumentException("[ERROR] ๋ก๋ ๋ฒํธ๋ 1๋ถํฐ 45 ์ฌ์ด์ ์ซ์์ฌ์ผ ํฉ๋๋ค.");
+ }
+ }
+
+}
diff --git a/src/main/java/lotto/game/Game.java b/src/main/java/lotto/game/Game.java
new file mode 100644
index 0000000000..df7b6c0384
--- /dev/null
+++ b/src/main/java/lotto/game/Game.java
@@ -0,0 +1,5 @@
+package lotto.game;
+
+public interface Game {
+ public void play();
+}
diff --git a/src/main/java/lotto/game/InputWinLotto.java b/src/main/java/lotto/game/InputWinLotto.java
new file mode 100644
index 0000000000..f0876ecfc3
--- /dev/null
+++ b/src/main/java/lotto/game/InputWinLotto.java
@@ -0,0 +1,47 @@
+package lotto.game;
+
+import camp.nextstep.edu.missionutils.Console;
+import lotto.checkexception.CheckCharException;
+import lotto.lotto.Lotto;
+import lotto.lotto.WinningLotto;
+import lotto.checkexception.CheckException;
+import lotto.checkexception.CheckExceptionImpl;
+import lotto.numbers.RandomRange;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class InputWinLotto {
+ private final WinningLotto winningLotto;
+ private final Lotto lotto;
+
+ public InputWinLotto(){
+ System.out.println("๋น์ฒจ ๋ฒํธ๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.");
+ String input = Console.readLine().toString();
+ String[] words = input.split(",");
+ List list = new ArrayList<>();
+ CheckException checkException = new CheckExceptionImpl();
+ CheckCharException checkCharException = new CheckCharException();
+ for (String word : words) {
+ checkCharException.checkCharException(word);
+ int check = Integer.parseInt(word);
+ checkException.checkException(check);
+ if(list.contains(check)) throw new IllegalArgumentException("[ERROR]๋ก๋ ๋ฒํธ๋ ์ค๋ณต๋ ์ ์์ต๋๋ค.");
+ list.add(check);
+ }
+ if(list.size() != RandomRange.SIZE.getValue()) throw new IllegalArgumentException("[ERROR]์ซ์ 6๊ฐ๋ฅผ ์
๋ ฅํด์ฃผ์ธ์.");
+
+ lotto = new Lotto(list);
+ System.out.println("๋ณด๋์ค ๋ฒํธ๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.");
+ String inputBonus = Console.readLine();
+ checkCharException.checkCharException(inputBonus);
+ int bonus = Integer.parseInt(inputBonus);
+ checkException.checkException(bonus);
+ if(list.contains(bonus)) throw new IllegalArgumentException("[ERROR]๋ก๋ ๋ฒํธ๋ ์ค๋ณต๋ ์ ์์ต๋๋ค.");
+ winningLotto = new WinningLotto(lotto,bonus);
+ }
+
+ public WinningLotto getWinningLotto() {
+ return winningLotto;
+ }
+}
diff --git a/src/main/java/lotto/game/LottoGame.java b/src/main/java/lotto/game/LottoGame.java
new file mode 100644
index 0000000000..e9062db9bf
--- /dev/null
+++ b/src/main/java/lotto/game/LottoGame.java
@@ -0,0 +1,57 @@
+package lotto.game;
+
+import camp.nextstep.edu.missionutils.Randoms;
+import lotto.lotto.Lotto;
+import lotto.game.money.BuyMoney;
+import lotto.game.money.EarnMoney;
+import lotto.numbers.RandomRange;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class LottoGame implements Game{
+
+ private int [] prize = {0,0,0,0,0,0};
+ public LottoGame(){
+
+ }
+ @Override
+ public void play() {
+ try {
+ BuyMoney buyMoney = new BuyMoney();
+ int count = buyMoney.getBuyCount();
+ List lottoList = new ArrayList<>();
+ makeNewLottoList(count, lottoList);
+ for (Lotto lotto : lottoList) {
+ lotto.printValues();
+ }
+ InputWinLotto inputWinLotto = new InputWinLotto();
+
+ for (Lotto lotto : lottoList) {
+ Rank rank = new Rank(lotto, inputWinLotto.getWinningLotto());
+ rank.rankValue(prize);
+ }
+ EarnMoney earnMoney = new EarnMoney();
+ earnMoney.addMoney(prize);
+
+
+ PrintCorrectCount printCorrectCount = new PrintCorrectCount(prize);
+ printCorrectCount.print(calculateRate(buyMoney, earnMoney));
+ }catch(IllegalArgumentException e){
+ System.out.println(e.getMessage());
+ }
+
+ }
+
+ private static double calculateRate(BuyMoney buyMoney, EarnMoney earnMoney) {
+ double result = (double)earnMoney.getEarnMoney() / (double)buyMoney.getBuyMoney() * 100;
+ return Double.parseDouble(String.format("%.1f",result));
+ }
+
+ private static void makeNewLottoList(int count, List lottoList) {
+ for(int i = 0; i < count; i++){
+ List ranNum = Randoms.pickUniqueNumbersInRange(RandomRange.MIN_VALUE.getValue(), RandomRange.MAX_VALUE.getValue(),RandomRange.SIZE.getValue());
+ lottoList.add(new Lotto(ranNum));
+ }
+ }
+}
diff --git a/src/main/java/lotto/game/PrintCorrectCount.java b/src/main/java/lotto/game/PrintCorrectCount.java
new file mode 100644
index 0000000000..fcba8d1818
--- /dev/null
+++ b/src/main/java/lotto/game/PrintCorrectCount.java
@@ -0,0 +1,20 @@
+package lotto.game;
+
+public class PrintCorrectCount {
+ private final int[] prize;
+
+ public PrintCorrectCount(int [] prizeParam){
+ prize = prizeParam;
+ }
+
+ public void print(double temp){
+ System.out.println("3๊ฐ ์ผ์น (5,000์) - " + prize[5]+ "๊ฐ\n" +
+ "4๊ฐ ์ผ์น (50,000์) - " + prize[4]+ "๊ฐ\n" +
+ "5๊ฐ ์ผ์น (1,500,000์) - " + prize[3]+ "๊ฐ\n"+
+ "5๊ฐ ์ผ์น, ๋ณด๋์ค ๋ณผ ์ผ์น (30,000,000์) - " + prize[2]+ "๊ฐ\n" +
+ "6๊ฐ ์ผ์น (2,000,000,000์) - " + prize[1]+ "๊ฐ\n" +
+ "์ด ์์ต๋ฅ ์ " + temp + "%์
๋๋ค."
+ );
+
+ }
+}
diff --git a/src/main/java/lotto/game/Rank.java b/src/main/java/lotto/game/Rank.java
new file mode 100644
index 0000000000..880d88ba83
--- /dev/null
+++ b/src/main/java/lotto/game/Rank.java
@@ -0,0 +1,32 @@
+package lotto.game;
+
+import lotto.lotto.Lotto;
+import lotto.lotto.WinningLotto;
+
+public class Rank {
+ private final int count;
+ private final boolean isBonus;
+ Rank(Lotto lotto, WinningLotto winLotto){
+ count = lotto.countMatch(winLotto);
+ isBonus = lotto.isBonus(winLotto);
+ }
+
+ public void rankValue(int [] arr) {
+ if(count == 3) {
+ arr[5]++;
+ }
+ else if(count == 4) {
+ arr[4]++;
+ }
+ else if(count == 5 && !isBonus) {
+ arr[3]++;
+ }
+ else if(count == 5 && isBonus) {
+ arr[2]++;
+ }
+ else if(count == 6) {
+ arr[1]++;
+ }
+ }
+
+}
diff --git a/src/main/java/lotto/game/money/BuyMoney.java b/src/main/java/lotto/game/money/BuyMoney.java
new file mode 100644
index 0000000000..2c5053118c
--- /dev/null
+++ b/src/main/java/lotto/game/money/BuyMoney.java
@@ -0,0 +1,31 @@
+package lotto.game.money;
+
+import camp.nextstep.edu.missionutils.Console;
+import lotto.checkexception.CheckCharException;
+
+public class BuyMoney {
+ private final int buyMoney;
+ private final int buyCount;
+ private final String inputBuyMoney;
+ public BuyMoney(){
+ System.out.println("๊ตฌ์
๊ธ์ก์ ์
๋ ฅํด ์ฃผ์ธ์.");
+ inputBuyMoney = Console.readLine();
+ CheckCharException checkCharException = new CheckCharException();
+ checkCharException.checkCharException(inputBuyMoney);
+ buyMoney = Integer.parseInt(inputBuyMoney);
+ if(buyMoney % 1000 != 0){
+ throw new IllegalArgumentException("[ERROR]1000์ ๋จ์๋ก ์
๋ ฅํด ์ฃผ์ธ์.");
+ }
+
+ buyCount = buyMoney / 1000;
+ System.out.println(buyCount + "๊ฐ๋ฅผ ๊ตฌ๋งคํ์ต๋๋ค.");
+ }
+
+ public int getBuyMoney() {
+ return buyMoney;
+ }
+ public int getBuyCount(){
+ return buyCount;
+ }
+
+}
diff --git a/src/main/java/lotto/game/money/EarnMoney.java b/src/main/java/lotto/game/money/EarnMoney.java
new file mode 100644
index 0000000000..478487e70a
--- /dev/null
+++ b/src/main/java/lotto/game/money/EarnMoney.java
@@ -0,0 +1,22 @@
+package lotto.game.money;
+
+import lotto.numbers.Prize;
+
+public class EarnMoney {
+ private long earnMoney;
+ public EarnMoney(){
+ earnMoney = 0;
+ }
+
+ public void addMoney(int[] prizeParam){
+ earnMoney += Prize.FIRST.getValue() * prizeParam[1];
+ earnMoney += Prize.SECOND.getValue()* prizeParam[2];
+ earnMoney += Prize.THIRD.getValue()* prizeParam[3];
+ earnMoney += Prize.FOURTH.getValue()* prizeParam[4];
+ earnMoney += Prize.FIFTH.getValue()* prizeParam[5];
+ }
+
+ public long getEarnMoney() {
+ return earnMoney;
+ }
+}
diff --git a/src/main/java/lotto/lotto/Lotto.java b/src/main/java/lotto/lotto/Lotto.java
new file mode 100644
index 0000000000..7699dcc7ee
--- /dev/null
+++ b/src/main/java/lotto/lotto/Lotto.java
@@ -0,0 +1,42 @@
+package lotto.lotto;
+
+import java.util.List;
+
+public class Lotto {
+ private final List numbers;
+
+ public Lotto(List numbers) {
+ validate(numbers);
+ this.numbers = numbers;
+ }
+
+ private void validate(List numbers) {
+ if (numbers.size() != 6) {
+ throw new IllegalArgumentException();
+ }
+ }
+
+ // TODO: ์ถ๊ฐ ๊ธฐ๋ฅ ๊ตฌํ
+ public int countMatch(WinningLotto lotto){
+ int count = 0;
+ for (Integer number : this.numbers) {
+ if(lotto.getLotto().numbers.contains(number)) count++;
+ }
+ return count;
+ }
+
+ public boolean isBonus(WinningLotto lotto){
+ return this.numbers.contains(lotto.getBonus());
+ }
+
+ public void printValues(){
+ String str = "[";
+ for (Integer number : numbers) {
+ str += number.toString();
+ str += ", ";
+ }
+ str = str.substring(0, str.length() - 2);
+ str += "]";
+ System.out.println(str);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/lotto/lotto/WinningLotto.java b/src/main/java/lotto/lotto/WinningLotto.java
new file mode 100644
index 0000000000..6676752f00
--- /dev/null
+++ b/src/main/java/lotto/lotto/WinningLotto.java
@@ -0,0 +1,18 @@
+package lotto.lotto;
+
+public class WinningLotto {
+ private final Lotto lotto;
+ private final int bonus;
+ public WinningLotto(Lotto lotto, int bonus){
+ this.lotto = lotto;
+ this.bonus = bonus;
+ }
+
+ public Lotto getLotto() {
+ return lotto;
+ }
+
+ public int getBonus() {
+ return bonus;
+ }
+}
diff --git a/src/main/java/lotto/numbers/Prize.java b/src/main/java/lotto/numbers/Prize.java
new file mode 100644
index 0000000000..c7d9f52667
--- /dev/null
+++ b/src/main/java/lotto/numbers/Prize.java
@@ -0,0 +1,17 @@
+package lotto.numbers;
+
+public enum Prize {
+ NONE(0),FIFTH(5000),FOURTH(50000),
+ THIRD(1500000),SECOND(30000000),FIRST(2000000000);
+
+ private final long value;
+
+ private Prize(long value){
+ this.value = value;
+ }
+
+ public long getValue() {
+ return value;
+ }
+
+}
diff --git a/src/main/java/lotto/numbers/RandomRange.java b/src/main/java/lotto/numbers/RandomRange.java
new file mode 100644
index 0000000000..abe18b0ccf
--- /dev/null
+++ b/src/main/java/lotto/numbers/RandomRange.java
@@ -0,0 +1,15 @@
+package lotto.numbers;
+
+public enum RandomRange {
+ MIN_VALUE(1),MAX_VALUE(45),SIZE(6);
+
+ private final int value;
+
+ RandomRange(int value){
+ this.value = value;
+ }
+
+ public int getValue(){
+ return value;
+ }
+}