import java.util.LinkedHashSet;
import java.util.Random;
class Lotto{
private int[] arr; // 당첨번호
public Lotto(){
arr = new int[7];
setArr();
}
public int[] getArr() {
return arr;
}
public void setArr() {
LinkedHashSet<Integer> a = new LinkedHashSet<>();
Random rand = new Random();
int cnt=0;
//중복 없이 7개 숫자 저장
while(a.size()<7) {
a.add(rand.nextInt(45)+1);
}
for(Integer g : a) {
arr[cnt] = g;
cnt++;
}
}
public void disp() {
System.out.print("당첨번호 :"+ arr[0] +" "+ arr[1] +" "+arr[2] + " " + arr[3]+ " "+ arr[4]+ " "+ arr[5]+" 보너스 :"+arr[6]);
}
public void first() {
System.out.println("=====1등 당첨번호=====");
for(int i=0; i<arr.length-1; i++) {
System.out.print(arr[i]+" ");
}
System.out.println();
}
public void second() {
System.out.println("=====2등 당첨번호=====");
for(int i=0; i<arr.length-1; i++) {
for(int j=0; j<arr.length; j++) {
if(i == j) {
System.out.print("* ");
}
else {
System.out.print(arr[j]+" ");
}
}
System.out.println();
}
}
public void third() {
System.out.println("=====3등 당첨번호=====");
for(int i=0; i<arr.length-1; i++) {
for(int j=0; j<arr.length-1; j++) {
if(i == j) {
System.out.print("* ");
}
else {
System.out.print(arr[j]+" ");
}
}
System.out.println();
}
}
public void fourth() {
System.out.println("=====4등 당첨번호=====");
for(int i=0; i<arr.length-1; i++) {
for(int j=i+1; j<arr.length-1; j++) {
for(int k=0; k<arr.length-1; k++) {
if(k == i) System.out.print("* ");
else if(k == j) System.out.print("* ");
else System.out.print(arr[k]+" ");
}
System.out.println();
}
}
}
public void fifth() {
System.out.println("=====5등 당첨번호=====");
for(int i=0; i<arr.length-1; i++) {
for(int j=i+1; j<arr.length-1; j++) {
for(int k=j+1; k<arr.length-1; k++) {
for(int m=0; m<arr.length-1; m++) {
if(m == i) System.out.print("* ");
else if(m == j) System.out.print("* ");
else if(m == k) System.out.print("* ");
else System.out.print(arr[m]+" ");
}
System.out.println();
}
}
}
}
}
public class LottoProgram {
public static void main(String[] args) {
Lotto lotto = new Lotto();
lotto.disp();
System.out.println();
lotto.first();
System.out.println();
lotto.second();
System.out.println();
lotto.third();
System.out.println();
lotto.fourth();
System.out.println();
lotto.fifth();
}
}