Assist in completing the template Description This function
Assist in completing the template.
Description: This function applies discount percentage on an item price unless the item price is less than the whole sale price. For example, a product at $10 with a wholesale price of $5 and a discount of 10% returns $9. function applyDiscount(productPrice: Double, wholesalePrice: Double, discount: Double) Return Double Create variable discountedPrice as double discountedPrice = productPrice * (1 - discount) if (discountedPriceSolution
Line 1: It states the description of the program as what it does.
Line 2: declares a function applyDiscount with arguments as productPrice ,wholesalePrice, discount. These all are of double datatypes and function returns a double parameter.
Line 3: creates a local variable of double datatype as discountedPrice.
Line 4: calculation of discountedPrice takes place with productPrice and discount.
Line 5: conditional statement which compares discountedPrice with wholesalePrice .
Line 6: if the above conditional statement is true i.e discountedPrice is less than wholesalePrice then it assigns wholesalePrice to discountedPrice.
Line 7: the end of conditional statement.
Line 8 : function returns the argument discountedPrice.
Line 9: end of function.

