public class Solution { public static void main(String[] args) { int count = 0; int color; int number; String colorStr; String numberStr; String[] colorSet = {" ", " ", " ", " "}; while(true) { color = (int)(Math.random() * 4); number = (int)(Math.random() * 13); colorStr = getColor(color); numberStr = getNumber(number); System.out.println(numberStr + " of " + colorStr); count++; if(!contains(colorSet, colorStr)) add(colorSet, colorStr); if(isFull(colorSet)) break; } System.out.println("Number of picks: " + count); } public static boolean isFull(String[] array) { for(String str: array) if(str == " ") return false; return true; } public static boolean contains(String[] array, String str) { for(String i: array) if(i == str) return true; return false; } public static void add(String[] array, String str) { for(int i = 0; i < array.length; i++) if(array[i] == " ") array[i] = str; } public static String getColor(int n) { if(n == 0) return "Spades"; else if(n == 1) return "Clubs"; else if(n == 2) return "Hearts"; else return "Diamonds"; } public static String getNumber(int n) { if(n == 0) return "King"; else if(n == 1) return "Ace"; else if(n == 11) return "Jack"; else if(n == 12) return "Queen"; else return "" + n; } }