CSC 455: Assignment 03 | Due date: See Blackboard Instructor: Dr. Razib Iqbal | www.razib.info
Note: This is an individual assignment. If you have questions, then please consult with the course instructor ONLY.
Q1: 15 points (5 + 5 + 5) a. Draw the flowchart and the respective control-flow graph (CFG) for ReturnAverage(). b. Based on the flowchart and CFG, select the minimum number of paths to achieve 100% statement
coverage in ReturnAverage().
c. Based on the flowchart and CFG, select the minimum number of paths to achieve 100% branch coverage in ReturnAverage().
In your answer for “b” and “c”, do not just give numbers (for example, 5 paths). Also, write down the exact paths. /* Function: ReturnAverage computes the average of all those numbers in the input array in the positive range [MIN, MAX]. The maximum size of the array is AS. But, the array size could be smaller than AS in which case the end of input is represented by -999. */ public static double ReturnAverage(int value[], int AS, int MIN, int MAX){ int i, ti, tv, sum; double av; i = 0; ti = 0; tv = 0; sum = 0; while (ti < AS && value[i] != -999) { ti++; if (value[i] >= MIN && value[i] <= MAX) { tv++; sum = sum + value[i]; } i++; } if (tv > 0) av = (double)sum/tv; else av = (double) -999; return (av); }
Q2: 25 points See the attached JAVA files (LocalUser.java, RoamingUser.java, PolicyUser.java). Write sufficient JUnit tests for each of the PolicyUser, LocalUser, and RoamingUser classes.
a. There must be a separate test class for each of the above classes. (3 Points)
b. There must be at least one test case for each of the methods. (15 Points)
c. Create a test suite to run all the test classes in the given order. (3 Points)
d. Submit your Junit test files as well as screen captures (in the Word/PDF file) covering the above 3 aspects including overall achieved coverage for this Eclipse project using EclEmma tool. (4 Points)