so that the execution of this function will return the price for quantity number of the item priced originally at itemPrice each, and currently discounted according to discountType. For instance, calculateItemCost(10.90, 'D', 2) will return 17.44 because 17.44=10.9*0.8*2. Likewise calculateItemCost(5.50, 'B', 4) will return the value 19.8=5.50*0.9*4.
if (strcmp(discountType,"A")==0) price *= 0.95; if (strcmp(discountType,"B")==0) price *= 0.9; if (strcmp(discountType,"C")==0) price *= 0.85; if (strcmp(discountType,"D")==0) price *= 0.8;
Comments
Leave a comment