1. int counter = 0; for (int j = 0; j < text.length(); j++) if (text.charAt(j) == ch) counter++; return counter; 2. while (message.length() < 10) message = JOptionPane(.....); OR String message; do { message = JOptionPane(.....); } while (message.length() < 10); 3. boolean valid; do { try { System.out.println("How many messages?"); numMsgs = scan.nextInt(); if (numMsgs < 1) { System.out.println("ERROR"); valid = false; } else valid = true; } catch (InputMismatchException e) { System.out.println("ERROR"); valid = false; } scan.nextLine(); // clear input buffer } while (!valid); 4. int[] countArray = new int[26]; for (int i = 0; i < text.length; i++) { char ithchar = text.charAt(i); if (Character.isLetter(ithchar)) countArray[ithChar-'A']++; } for (int i = 0; i < countArray.length; i++) { System.out.println((char)('A'+i) + " " + countArray[i]);