/* * Aresh Saharkhiz * saharkiz@gmail.com * Associate Professor / Mapua Institute of Technology / Philippines */ using System; // Introduction to Software Testing // Authors: Paul Ammann & Jeff Offutt // Chapter 2, section 2.4, page 74 internal class trashAndTakeOut { public static void trash(int x) { int m, n; m = 0; if (x > 0) { m = 4; } if (x > 5) { n = 3 * m; } else { n = 4 * m; } int o = takeOut(m, n); Console.WriteLine("o is: " + o); } public static int takeOut(int a, int b) { int d, e; d = 42 * a; if (a > 0) { e = 2 * b + d; } else { e = b + d; } return (e); } public static void Main(string[] argv) { // Driver method for trashAndTakeOut // Read an integer from standard input, call trashAndTakeOut() if (argv.Length != 1) { Console.WriteLine("Usage: java trashAndTakeOut v1"); return; } int x = 0; try { x = Convert.ToInt32(argv[0]); } catch (FormatException) { Console.WriteLine("Entry must be an integer, using 1."); x = 1; } trash(x); } }