CSPP51036 Java Programming Prof. Gerber Fall 2012 Homework 3 1.FibonacciDriver. (10 points) Create a driver class with an executable main method called FibonacciDriver.java. Call a method from main called fibonacci (private static) that prints the sum of a fibonacci sequence to the console using System.out.print. Get a number from the user and call System.out.println(fibonacci(nUserNumber)); from within main. You must implement this method recurisvely. For a reference on Fibonacci, see http://en.wikipedia.org/wiki/Fibonacci_number or http://www.maths.surrey.ac.uk/hosted-sites/R.Knott/Fibonacci/fibCalcX.html ----------------------------------- 2. ReverseDriver. (10 points) Create a driver class with an executable main method called ReverseDriver.java. Call a method from main called reverso (private static) that prints the reverse words to the console using System.out.println(). reverso may either return a String which you then print using System.out in main, or reverso may return void and call System.out itself. Passing in "yoda says force the is strong" to reverso along with other possible parameters results in "strong is the force says yoda". You must implement this method recurisvely. ----------------------------------- 3. VarArgsDriver. (10 points) Create a driver class with an executable main method called VarArgsDriver.java. Call a method from main called getLowHigh with the following signature: private static String getLowHigh(String... strArgs) getLowHigh returns a string that represents the low and high values of a variable series of strings, for example System.out.println(getLowHigh("Vancouver", "Philly", "New York", "Chicago", "Los Angeles", "Miami", "Oakland")); will print: Chicago and Vancouver to the console. ----------------------------------- 4. VarArgsDriver2. (10 points) Create a driver class with an executable main method called VarArgsDriver2.java. Call a method from main called getReverseHigh() with the following signature: private static String getReverseHigh(String... strArgs). getReverseHigh should be implemented iteratively. Also, getReverseHigh calls a helper method called reverseCharsRec with the following signature public static String reverseCharsRec(String str) and this mehtod must be implemented recursively. getReverseHigh returns a string that represents the reverse characters of the high value of a variable series of strings, for example System.out.println(getReverseHigh("Vancouver", "Philly", "New York", "Chicago", "Los Angeles", "Miami", "Oakland")); will print: revuocnaV to the console. ----------------------------------- 5. ReflectDriver. (10 points) Create a class that takes a string from the user in the form of a fully-qualified class name. Modify the code from edu.uchicago.cs.java.lec05.reflection from lec05.tar. ReflectDriver will use reflection to inspect and print out any constants or normal fields of a class like so: input>java.lang.Math output> class java.lang.Math { //PUBLIC STATIC FINAL FIELDS (CONSTANTS) public static final double E; public static final double PI; //OTHER FIELDS private static java.util.Random randomNumberGenerator; private static long negativeZeroFloatBits; private static long negativeZeroDoubleBits; } ----------------------------------- 6. Hangman (50 points ) Create a hangman game using WindowBuilder. The rules of the game are here: http://en.wikipedia.org/wiki/Hangman_(game) Since you are building a GUI, user-experience falls under the style rubric of the grading criteria, so you will be graded not only for the style of your code, but also for the aesthetics of the GUI. Consider the use of sounds as well. Use the following web-service to generate random words: http://randomword.setgetgo.com/get.php. You can use the following code example to read the data directly from any site http://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html. You may also consider using json, but you're not required to do so. Reading data from the site http://randomword.setgetgo.com/get.php without the use of Json will result in a slightly corrupted string, for example: %^#nonmimetic However, you can parse it because the unicode values for lowercase chars in English have a range between 97 and 122 inclusive. When taken character by character, the gibberish above has a value of 239 187 191 110 111 110 109 105 109 101 116 105 99 You can see that the first three characters are gibberish (and fall out of range) while the rest of the string forms the word nonmimetic. You should handle network connectivity exceptions in your code.