A customer in a store is purchasing five items. Design a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 6 percent. P.S. must be shown in psuedocode.
anyone there?
migaki is there?
Module TotalPurchase() Declare Double amount,total Declare TAX = .06 While i < 6 Display "Enter the price: " Input amount total = total + amount i = i + 1 End While Display "Subtotal is: " + total Display "Tax is: " + (total*TAX) Display "Total is: " + ((total*TAX) + total) End Module
can we take this piece by piece?
I want to understand the logic behind what is being done
In other words, how was each step done?
you still there migaki?
hey phi, do you know much about psuedocode?
I am trying to understand the logic of the answer provided above
let me see if I can somehow make the stone start rolling
So to begin the process, we need to declare what we are talking about? In other words, we have to define the entire purchase, correct? I guess that is why module TotalPurchase() is used correct?
phi you here?
Yes, that's how you begin. Losing connection..
ahh, so what does the logic go from there?
Are we declaring variables next? IF so, why is double amount included?
and why is i<6?
migaki, you still there or you having trouble with connection?
anyone still here?
Because you have 5 items, which is less than 6, hence i<6.
ahh, so i= number of items, correct?
Yup
ok, so what other logic coudl you help me out with?
why are we declaring double amount, total?
migaki is still there?
don't forget to initialize i to 0
Double is declared because you are using a floating point variable i.e. Money (decimal point number) though the answer above isn't really pseudocode
Join our real-time social learning platform and learn together with your friends!