-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathOutput.java
More file actions
26 lines (21 loc) · 1.02 KB
/
Output.java
File metadata and controls
26 lines (21 loc) · 1.02 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
package lotto.view;
import lotto.domain.LottoTicket;
import java.util.List;
import java.util.Map;
public class Output {
public static void showLottoTickets(List<LottoTicket> tickets) {
System.out.println("");
tickets.forEach(ticket -> System.out.println(ticket.getLottoNumbers()));
}
public static void showResult(Map<Integer, Integer> counter, int money) {
System.out.println("");
System.out.println("당첨 통계");
System.out.println("----------------------------");
System.out.printf("3개 일치 (5,000원) - %d개\n", counter.getOrDefault(3, 0));
System.out.printf("4개 일치 (50,000원) - %d개\n", counter.getOrDefault(4, 0));
System.out.printf("5개 일치 (1,500,000원) - %d개\n", counter.getOrDefault(5, 0));
System.out.printf("모두 일치 (2,000,000,000원) - %d개\n", counter.getOrDefault(6, 0));
System.out.println("");
System.out.printf("총 수익률은 %.2f입니다.\n\n\n", (double) counter.get(7) / money);
}
}