11package com .javabom .lotto .view ;
22
3+ import com .javabom .lotto .domain .ticket .ManualLottoNumbers ;
4+
5+ import java .util .ArrayList ;
36import java .util .Arrays ;
47import java .util .List ;
58import java .util .Scanner ;
69import java .util .stream .Collectors ;
710
811public class InputView {
912
13+ private static final String DELIMITER_COMMA = "," ;
1014 private static final String NOTICE_INPUT_MONEY = "구입 금액을 입력해 주세요. 잔돈은 없습니다 ^^" ;
1115 private static final String NOTICE_INPUT_BASIC_LUCKY_NUMBER = "지난 주 당첨 번호를 입력해 주세요. (,로 나눠서 입력)" ;
1216 private static final String NOTICE_INPUT_BONUS_NUMBER = "보너스 볼을 입력해 주세요." ;
17+ private static final String NOTICE_INPUT_MANUAL_LOTTO_AMOUNT = "수동으로 구매할 로또 수를 입력해 주세요." ;
18+ private static final String NOTICE_INPUT_MANUAL_LOTTO_NUMBER = "수동으로 구매할 번호를 입력해 주세요." ;
1319
1420 private static final Scanner scanner = new Scanner (System .in );
1521
@@ -20,7 +26,7 @@ public static int getMoneyToBuyTicket() {
2026
2127 public static List <Integer > getLottoBasicLuckyNumbers () {
2228 printLineOf (NOTICE_INPUT_BASIC_LUCKY_NUMBER );
23- return Arrays .stream (scanner .nextLine ().split ("," ))
29+ return Arrays .stream (scanner .nextLine ().split (DELIMITER_COMMA ))
2430 .map (Integer ::parseInt )
2531 .collect (Collectors .toList ());
2632 }
@@ -30,6 +36,26 @@ public static int getBonusNumber() {
3036 return scanner .nextInt ();
3137 }
3238
39+ public static int getManualLottoAmount () {
40+ printLineOf (NOTICE_INPUT_MANUAL_LOTTO_AMOUNT );
41+ return Integer .parseInt (scanner .nextLine ());
42+ }
43+
44+ public static List <ManualLottoNumbers > getManualLottoNumbers (int amount ) {
45+ printLineOf (NOTICE_INPUT_MANUAL_LOTTO_NUMBER );
46+ List <ManualLottoNumbers > manualLottoNumbers = new ArrayList <>();
47+ for (int i = 0 ; i < amount ; i ++) {
48+ manualLottoNumbers .add (new ManualLottoNumbers (getManualLottoNumber ()));
49+ }
50+ return manualLottoNumbers ;
51+ }
52+
53+ public static List <Integer > getManualLottoNumber () {
54+ return Arrays .stream (scanner .nextLine ().split (DELIMITER_COMMA ))
55+ .map (Integer ::parseInt )
56+ .collect (Collectors .toList ());
57+ }
58+
3359 private static void printLineOf (String string ) {
3460 System .out .println (string );
3561 }
0 commit comments