Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Consider the code of the method total _ cost _ with _ shipping which is used to calculate the total cost in a program with
Consider the code of the method totalcostwithshipping which is used to calculate the total cost in a program with the following specification. The code is available on Moodle.
There is an online vendor that sells items to customers. The vendor sells two kinds of items and each kind has a different price. A customer can place an order containing any number of items from each kind. There should be at least one item per order. A AED shipping fee is waived for purchases of AED or more. The program asks the customer to enter the number of required items from each kind, then it should print the final cost of the order in a detailed fashion as presented in the output of a sample run below.
tableKindItem Price
Please enter the number of A items:
Please enter the number of items:
Total Item Cost: AED
Shipping Cost: AED
Total Cost with shipping: AED
a Draw a control flow graph for the program and clearly label each node to show its correspondence to a statement.
b Calculate the program's 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.
For each test case, you must provide the input values and the output value in addition to the covered path. The method has two integer parameters: numA and numB The method returns the total cost with shipping.
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