Question: Given the following method: public class Calculator { / / Method to test with all def - use path criteria public static int calculateDiscount (
Given the following method:
public class Calculator
Method to test with all defuse path criteria
public static int calculateDiscountint price, int customerYears, boolean isSpecialOffer
int discount;
if isSpecialoffer
discount ; Special offer discount
else
discount Base discount
if customerYears
discount ; Loyalty bonus
int finalPrice price price discount ;
if finalPrice
finalPrice ; Ensure final price is not negative
return finalPrice;
Complete the following tasks:
Draw a control flow graph for the lcs method.
Enumerate the nodes in the graph.
Label the control graph with defs and uses at the appropriate nodes.
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
