1. The function below takes a String as a parameter and returns a new String that is the reverse of the original. Rewrite this function so that it uses a for loop instead of a while loop: String reverse(String s){ int index = s.length()-1; String result = ""; while( index >= 0 ){ result += s.charAt(index); index--; } return result; } 2. You write the function below that is supposed to take a person's first name and last name and whether or not the first name should come first. It should then return a String with the names all capitalized in the appropriate order. For example, a call: name("Dave", "Kauchak", true) should give you: "DAVE KAUCHAK" and a call: name("Dave", "Kauchak", false) should give you "KAUCHAK, DAVE" The function: String name(String first, String last, boolean firstNameFirst){ first.toUpperCase() last.toUpperCase() if( firstNameFirst ){ return first + " " + last; }else{ return last + ", " + first; } } You try it out: name("Amy", "TheProgrammer", false) and get "TheProgrammer, Amy", which is not right (it should be all caps!). a) What do you think the problem is? If you need a hint, take a look at the documentation for the String class: http://docs.oracle.com/javase/7/docs/api/java/lang/String.html b) How should you fix this (i.e. rewrite the function above so that it works correctly)?