-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathLottoTicketsAutoInput.java
More file actions
34 lines (27 loc) · 1.24 KB
/
LottoTicketsAutoInput.java
File metadata and controls
34 lines (27 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.nextstep.camp.lotto.view.component;
import com.nextstep.camp.common.strategy.InputStrategy;
import com.nextstep.camp.common.view.component.AbstractInput;
import com.nextstep.camp.lotto.domain.entity.LottoTickets;
import com.nextstep.camp.lotto.domain.vo.LottoCount;
public class LottoTicketsAutoInput extends AbstractInput<LottoTickets> {
private final LottoCount autoCount;
private final LottoCount manualCount;
private LottoTicketsAutoInput(InputStrategy<LottoTickets> inputStrategy, LottoCount autoCount, LottoCount manualCount) {
super(inputStrategy);
this.autoCount = autoCount;
this.manualCount = manualCount;
}
public static LottoTicketsAutoInput create(InputStrategy<LottoTickets> inputStrategy, LottoCount autoCount, LottoCount manualCount) {
return new LottoTicketsAutoInput(inputStrategy, autoCount, manualCount);
}
@Override
public String getLabel() {
return String.format("수동으로 %d장, 자동으로 %d개를 구매했습니다.", manualCount.getCount(), autoCount.getCount());
}
@Override
public LottoTickets action() {
LottoTickets lottoTickets = super.action();
System.out.println(lottoTickets);
return lottoTickets;
}
}