Ask your own question, for FREE!
Computer Science 18 Online
OpenStudy (anonymous):

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.

OpenStudy (anonymous):

anyone there?

OpenStudy (anonymous):

migaki is there?

OpenStudy (anonymous):

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

OpenStudy (anonymous):

can we take this piece by piece?

OpenStudy (anonymous):

I want to understand the logic behind what is being done

OpenStudy (anonymous):

In other words, how was each step done?

OpenStudy (anonymous):

you still there migaki?

OpenStudy (anonymous):

hey phi, do you know much about psuedocode?

OpenStudy (anonymous):

I am trying to understand the logic of the answer provided above

OpenStudy (anonymous):

let me see if I can somehow make the stone start rolling

OpenStudy (anonymous):

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?

OpenStudy (anonymous):

phi you here?

OpenStudy (anonymous):

Yes, that's how you begin. Losing connection..

OpenStudy (anonymous):

ahh, so what does the logic go from there?

OpenStudy (anonymous):

Are we declaring variables next? IF so, why is double amount included?

OpenStudy (anonymous):

and why is i<6?

OpenStudy (anonymous):

migaki, you still there or you having trouble with connection?

OpenStudy (anonymous):

anyone still here?

OpenStudy (anonymous):

Because you have 5 items, which is less than 6, hence i<6.

OpenStudy (anonymous):

ahh, so i= number of items, correct?

OpenStudy (anonymous):

Yup

OpenStudy (anonymous):

ok, so what other logic coudl you help me out with?

OpenStudy (anonymous):

why are we declaring double amount, total?

OpenStudy (anonymous):

migaki is still there?

OpenStudy (woodrow73):

don't forget to initialize i to 0

OpenStudy (anonymous):

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

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!