Posted: September 18th, 2017
Examine the pseudocode sample provided, and explain what it does line by line.
Unit 5 Pseudocode Sample
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 (discountedPrice < wholesalePrice)
discountedPrice = wholesalePrice
end if
return discountedPrice
End function
Present a solution using pseudocode similar to what you saw above.
Please submit your assignment.
For assistance with your assignment, please use your text, Web resources, and all course materials.
Place an order in 3 easy steps. Takes less than 5 mins.