/* * Fill in the body of the methods below based upon the specification * provided. It may be helpful to look at the test cases provided in * Hw3pr2Test.java to understand the intended behavior of the method. * * All content is based upon problems at CodingBat.com */ public class Hw3pr2 { // Source: http://codingbat.com/prob/p184031 /* * Given an array of ints, return the number of 9's in the array. */ public static int arrayCount9(int[] nums) { return 0; } // Source: http://codingbat.com/prob/p186031 /* * Given an array of ints, return true if one of the first 4 elements in the * array is a 9. The array length may be less than 4. */ public static boolean arrayFront9(int[] nums) { return true; } // Source: http://codingbat.com/prob/p136041 /* * * Given an array of ints, return true if .. 1, 2, 3, .. appears in the * array somewhere. */ public static boolean array123(int[] nums) { return true; } // Source: http://codingbat.com/prob/p110019 /* * * Given an array of ints, return the number of times that two 6's are next * to each other in the array. Also count instances where the second "6" is * actually a 7. */ public static int array667(int[] nums) { return 0; } // Source: http://codingbat.com/prob/p170221 /* * Given an array of ints, we'll say that a triple is a value appearing 3 * times in a row in the array. Return true if the array does not contain * any triples. */ public static boolean noTriples(int[] nums) { return true; } // Source: http://codingbat.com/prob/p167430 /* * Given an array of ints, return true if it contains a 2, 7, 1 pattern -- a * value, followed by the value plus 5, followed by the value minus 1. * Additionally the 271 counts even if the "1" differs by 2 or less from the * correct value. */ public static boolean has271(int[] nums) { return true; } /* * The code in main is run when you run the file Hw3pr3.java. * Modify the following function so that it prints something more interesting. * Modify the second to last line (part 2) so that it doesn't create an error * when it is run. It doesn't matter what index you reference, it just has to * Not produce an error! */ public static void main(String[] args){ System.out.println("something boring"); // modify part 1 int[] x = new int[4]; int y = x[8]; // modify part 2 System.out.println(y); } }