Examine the pseudocode sample provided, and explain what it does line by line. C
ID: 3694845 • Letter: E
Question
Examine the pseudocode sample provided, and explain what it does line by line.
Click here to access the sample.
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.
Present your Pseudocode here (to define the function) Present your Pseudocode here (to call the function)
Explanation / Answer
function defination:
boolean freeshipping(total_order_amount : Double)
{
if(total_order_amount>75.0)
return true;
else
return false;
}
function calling
int main();
{boolean b1;
double total_order_amount;
cout<<"enter the total order amount";
cin>>tota_order_amount;
b1=freeshipping(total_order_amount); // calling the above function
cout<<bi;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.