Project #82235 - Functions

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.

   Identify the logic needed to create a Boolean function to determine if free shipping will be applied based on the total order amount (e.g., free shipping for orders over $75). The function is expected to return TRUE or FALSE depending on the free shipping criteria.

 

Present a second pseudocode solution that will call the function and print whether the user will get free shipping.

Subject Computer
Due By (Pacific Time) 09/21/2015 12:00 am
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy