1) A new cryptology technique has been invented in which each pair of words in a message is combined to form one encrypted word. The combination is done as follows: - Both words are put into lower case. - The longer word is looked through in reverse order. - The new word is formed by taking a character from the (reversed) longer word, then a character from the shorter word, and so on. - When the shorter word runs out of characters, the rest of the longer word just goes on the end. For example, if s1 is "HI" and s2 is "hello", the result is "ohlileh". And if s1 is "secret" and s2 is "Words", the result is "tweorrcdess". Fill in the following method, which takes the pair of words as Strings and returns a String containing the encrypted word. If either argument is null, throw an exception with the message "Null argument". public static String encrypt(String s1, String s2) throws Exception { // Complain if one is null if (s1==null || s2==null) throw new Exception("Null argument"); // Figure out which is longer and make lower-case String longer, shorter; if (s1.length() > s2.length()) { longer = s1.toLowerCase(); shorter = s2.toLowerCase(); } else { longer = s2.toLowerCase(); shorter = s1.toLowerCase(); } // Construct the new one by alternating letters int i, j; StringBuffer sb = new StringBuffer(""); for (i=longer.length()-1, j=0; j=0) { sb.append(longer.charAt(i)); i--; } return sb.toString(); } 2) Fill in the following method. It should ask the user for two filenames, and return the one that comes later in Java's alphabet. Don't allow either one to be an empty string, and don't let the user enter the same string both times. Also make sure that the method doesn't need to throw any exceptions (do something reasonable if it does). public static String getFilename(BufferedReader buf) { try { // Get first name. System.out.print("Enter first filename: "); String name1 = buf.readLine(); while (name1.equals("")) { System.out.print("Enter a non-empty filename: "); name1 = buf.readLine(); } // Get second name. System.out.print("Enter second (different) filename: "); String name2 = buf.readLine(); while (name2.equals("") || name2.equals(name1)) { System.out.print("Enter a different non-empty filename: "); name2 = buf.readLine(); } // Return the "bigger" one if (name1.compareTo(name2) > 0) return name1; else return name2; } catch (IOException e) { System.out.println("I/O error, quitting."); System.exit(0); return null; // Just to make the compiler happpy } }