Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Jason typically uses the Internet to buy various items. It the total cost of all

ID: 3845859 • Letter: J

Question

Jason typically uses the Internet to buy various items. It the total cost of all of the items ordered, at one time, is $250 or more, then the shipping and handling is free, otherwise the shipping and handling is $15 PER ITEM. Design an algorithm that prompts Jason to enter the number of items ordered and the price of each item. (Remember cost = number of items order times price) The algorithm then outputs the total billing amount including shipping and handling. Your algorithm must use a loop (repetition structure) to get the number and price of each item. Write this in algorithm format not program code format.

Explanation / Answer

// to store number of different items
n = input("Enter number of distinct items")

// to strore order amount
order_amount = 0;

// For each item, prompt user to enter quantity and unit price
// add the cost to order total
for i=1 -> n :
   price = input("Enter item price")
   quantity = input("Enter item quantity")
   order_amount = order_amount + (price * quantity)
end for

// if order total is greater than or equal to 250$, shipping is free,
// else it will be 15$ per item.
if(order_amount >= 250):
   output("Shiping is free")
else
   shipping = n * 15
   output("Shipping will be ", shipping, "$.")
end if

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote