Answered step by step
Verified Expert Solution
Link Copied!

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 total_cost_with_shipping 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 10AED shipping fee is waived for purchases of 200AED 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.
\table[[Kind,Item Price],[A,40],[B,70]]
Please enter the number of A items: 2
Please enter the number of B items: 1
Total Item Cost: 150 AED
Shipping Cost: 10 AED
Total Cost with shipping: 160AED
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: num_A and num_B. The method returns the total cost with shipping.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago