Question: package sample;import java.util.Scanner;public class CostCalculator { public static void main ( String args [ ] ) { System.out.print ( Please enter the number of
package sample;import java.util.Scanner;public class CostCalculator public static void mainString args System.out.printPlease enter the number of A items: ; Scanner s new ScannerSystemin; int numA snextInt; System.out.printPlease enter the number of B items: ; int numB snextInt; System.out.printlnTotal cost with shipping: totalcostwithshippingnumAnumB; public static int totalcostwithshippingint numA int numB int totcost; ifnumA return ; ifnumB return ; ifnumA numB return ; totcost numA ; totcost numB ; iftotcost
totcost ; return totcost;
a Draw a control flow graph for the program and clearly label each node to show its correspondence to a statement
b Calculate the programs cyclomatic complexity. What does this mean in terms of the number of test cases to cover the code with respect to its branches?
c Develop a set of test cases to achieve full path coverage.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
