Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started