3. Online Purchase ─ Pseudocode: Provide a solution to the below problem in the form of pseudocode.
Online Purchase ─ Flowchart: To get your personal budget under control, you need to know how much you pay for each of your online purchases. To help with your calculations, you decide to draw a flowchart. Your flowchart should read the price of an item and read the quantity you want to purchase of that item. Your flowchart should then calculate the sales tax and shipping cost, and print the shipping cost and total cost. Every purchase is charged a 5% sales tax. After tax has been added, if the cost is less than $50, then shipping is $6. Otherwise, shipping is free. Sample session: Enter price of purchase item: 8 Enter quantity of items purchased: 3 Your shipping cost is $6. Your total payment is $31.2. Another sample session: Enter price of purchase item: 30.2 Enter quantity of items purchased: 2 Your shipping is free! Your total payment is $63.42. As always, make sure your print statements generate output that matches the sample session’s format. Use the words shown. Don’t forget the colons, spaces, the $, and the closing punctuation. 3. Online Purchase ─ Pseudocode: Provide a solution to the previous problem in the form of pseudocode.
PSEUDOCODE:
function main() priceOfItem = input('Enter price of purchase item: $') qty = input('Enter quantity of items purchased: ') costOfPurchase = priceOfItem * qty salesTax = costOfPurchase * 5 / 100 costOfPurchaseWithTax = costOfPurchase + salesTax if costOfPurchaseWithTax < 50 output('Your shipping cost is $6.') totalCost = costOfPurchaseWithTax + 6 else output('Your shipping is free!') totalCost = costOfPurchaseWithTax end output('Your total payment is $' + totalCost + '.') end
Get Answers For Free
Most questions answered within 1 hours.