/** * @author (PUT YOUR NAME HERE) #1% bonus for doing this! * Ignore the rubric; it's for regular programming * assignments. What is imporant here is GET IT TO WORK. * You are encouraged to write some simple tests * in main. * * Compile early and often. Compile this file before starting * to make sure you got it all. */ import java.util.ArrayList; import java.util.TreeMap; import java.math.BigInteger; public class LP0 { /** * Da main */ public static void main(String[] args) { //use this for any test code. } //#1 Easy problem: get this and you have a C. /** * This function pulls all vowels, in * from a string * and returns them bundled in a string * @param s the string you are extracting from * @return a string containing all vowels (aeiou) * from s in their original case. */ public static String vowelExtractor(String s) { return ""; } //********** Medium Problems*********** //get easy + 1 medium B- //get easy + 2 medium B //get easy + 3 medium B+ //#2 Medium /** * This functon tests if the BigInteger passed it is a factorial. * @param b is a BigInteger * @return true if b is the factorial of some positive integer. */ public static boolean isAFactorial(BigInteger b) { return false; } //#3 Medium /** * This function returns a new array list with * all elements from the array list a begin with all * letters between characters low and high, inclusive * @param a an array list of strings * @param low a letter character * @param high a letter character * @return a new array list containing all entries of a * whose first letter is between low and high, inclusive, * case insensitive. * If low > high, switch them. NOTE: * characters are primitives, use <, >, <= , >= != == to * compare them! */ public static ArrayList betweens(ArrayList a, char low, char high) { return null; } //#4 :medium /** * This returns the nth Tribblenocci number as a BigInteger * @param n a positive integer * @return the nth Tribblenocci number. * tribbles(0) -> 0 * tribbles(1) -> 1 * tribbles(2) -> 1 * Each succeeding Tribblenocci number is the sum of the preceding * three. */ public static BigInteger tribbles(int n) { return null; } //#5 mostOften: annoying but not impossible. //semi-hard //get this and get a bump up in grade //c -> b-, b- -> b, b -> b+, etc /** * This returns the sublist of BigIntegers in the list al * containing the integer n (0 <= n <= 0) the most times in the list. * @param n an integer satisfying 0 <= n <= 9. * @param al and array list of big integers * @return the a list containing the entries * of al containing n the most times (there will be more * than one entry in this list in the event of a tie or multiway tie. * example mostOften(5, [55, 123, 455, 22]) -> [55,455] * example mostOften(2, [55, 123, 455, 22]) -> [22] * example mostOften(9, [90909, 9929, 99, 110]) -> [9929, 90909] */ public static ArrayList mostOften(int n, ArrayList al) { return null; } // two grade bumps for this. //#6, challenging. New class! /** * This produces a hash map containing as keys the letters * a-z and values that show the number of times each character * appears in the string, case insensitive. * @param s a string * @return a "dictionary" in a TreeMap containing as keys * the letters a-z and as values the number of times * each character occurs in the string, case insensitive. */ public static TreeMap alphaCharCount(String s) { return null; } }