Close Icon
Info
Warning
Danger
 / 
 / 
 / 
Question Description: function applies discount percentage anitem price unless the item

Question : Question Description: function applies discount percentage anitem price unless the item : 864514

Question

Description: This function applies discount percentage on anitem 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 adiscount 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

 

Solution
5 (1 Ratings )

Solved
Computer Science 9 Months Ago 18 Views
This Question has Been Answered!

Unlimited Access

Explore More than 2 Million+
  • Textbook Solutions
  • Flashcards
  • Homework Answers
  • Documents
Signup for Instant Access!

Ask an Expert

Our Experts can answer your tough homework and study questions
154049 Computer Science Questions Answered!
Post a Question