/** * hwk1 file * Author: John Phaup * This is my own work * Date: 1/27/2014 * */ class jwphaup_hwk1 { public static boolean contains(T[] input, Check c) { boolean val = false; for(int i = 0; i { boolean ok( T item); //item T is ok (negative e.g.) } static public class Negative implements Check { public boolean ok( Integer val) { return val < 0; } } static public class Prime implements Check { public boolean ok(Integer val) { if (val % 2 ==0) return false; for(int x = 3; x <= val; x+=2) {if(val % x ==0) return false;} return true; } } static public class PerfectSquare implements Check { public boolean ok( Integer val){ for(int x = 0; x < (val/2); x++) if(x*x == val) return true; return false; } } }