CSPP51036-2 Java Programming Prof. Gerber Fall 2011 Homework 3 Due: Mon. Nov. 7th, 5:30pm 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.println(). You can just hard-code the value. i.e. call System.out.println(fibonacci(13)); from within main. No need to get input from the user. You must implement this method recurisvely. ----------------------------------- 2. ReverseDriver. (10 points) Create a driver class with an executable main method called ReverseDriver.java. No need to get input from the user. 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. No need to get input from the user. 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. No need to get input from the user. 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 (see lec05.tar for inspiration). 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. ContactManager. (50 points) See video called hw3_prob6.wmv for problem description in same directory as this file. In addition to the ContactManager class (which you will create using WB), create a Contact class with the following fields: private String strFirst; private String strLast; private String strPhone; private String strEmail; generate a constructor for the Contact class using all fields generate getters/setters override the toString() method (this will be displayed in the list) some more hints: Store your contacts in an ArrayList No need to persist the contacts to a text file or a database; i.e. it's ok if the contacts are cleared from memory when your application exits. use the absolute layout manager for the 'Add Contact' tab. JList and DefaultListModel http://www.java2s.com/Code/Java/Swing-JFC/AnexampleofJListwithaDefaultListModel.htm Determining if right-mouse-button is clicked http://www.java-tips.org/java-se-tips/java.awt.event/detect-the-mouse-button-used-when-clicking.html Getting the Selected Items in a JList Component http://www.exampledepot.com/egs/javax.swing/list_ListGetSel.html Adding and Removing an Item in a JList Component http://www.exampledepot.com/egs/javax.swing/list_ListAddRem.html