// Introduction to Software Testing // Authors: Paul Ammann & Jeff Offutt // Chapter 8; page ?? // Can be run from command line // No JUnit tests at this time. public class TwoPred { public static String twoPred (int x, int y) { boolean z; if (x < y) z = true; else z = false; if (z && x+y == 10) return "A"; else return "B"; } public static void main (String []argv) { // Driver method for twoPred // Read two integers from standard input, call twoPred() int []inArr = new int [argv.length]; if (argv.length != 2) { System.out.println ("Usage: java TwoPred v1 v2"); return; } for (int i = 0; i< argv.length; i++) { try { inArr [i] = Integer.parseInt (argv[i]);// } catch (NumberFormatException e) { System.out.println ("Entry must be an integer, using 1."); inArr [i] = 1; } } System.out.println("The result is: " + twoPred (inArr[0], inArr[1])); } }