PDA

View Full Version : very very basic algorithm problem about selection and repetition.




benlangdon
Feb 26, 2008, 01:06 AM
so i am supposed to write a flowchart for

(exact question)
draw a flowchart for a program that will compute and output the sales tax due with a tax rate of 7% and the total purchase price of 4 items. also perform a desk check with the following values 2.99, 3.99, 7.50 and 2.75.

i am supposed to use selection and repetition.

i am just stuck on if i

input price of item
then
running total = price of item + running total
then what do you put to make it go back and how do you write it so that the running total gets moved back up to the top.

(my brain hurts i just keep seeing it going into a loop. how do you make it stop, like only go for 4 items



ipo
Feb 26, 2008, 01:46 AM
draw a flowchart for a program that will compute and output the sales tax due with a tax rate of 7% and the total purchase price of 4 items.
i am supposed to use selection and repetition.
running total = price of item + running total
then what do you put to make it go back and how do you write it so that the running total gets moved back up to the top.


?! Better create some variables ?? I'm trying to figure out what exactly is the problem and.. i fail. Store , what you could ever need to run some procedures or clear some functions in a different variable so you could always refer to them later ??? i hope , there's the answer for you !?
:confused:

benlangdon
Feb 26, 2008, 02:02 AM
so here it is as simple as i can get it

draw a flowchart for a program that will compute and output the sales tax due with a tax rate of 7% and the total purchase price of 4 items. also perform a desk check with the following values 2.99, 3.99, 7.50 and 2.75.

so what i would have if it wasn't selection and repetition.

/input; item 1 (I1)
/input; item 2 (I2)
/input; item 3 ..
/input;item 4 ..
[Item total (IT) = I1+I2+I3+I4]
[TT (total tax)=IT * .07]
/output; TT
[Total Price (TP) = TT+IT
/output;TP

to be honest i have no clue what your saying. and saying ex." item total " that is saying that "item total " is some number ie a variable

toddburch
Feb 26, 2008, 07:16 AM
Do you mean like this:


1) Get an item
2) Add it's price to the total_price
3) Any more items?
4a) Yes, go to 1)
4b) No, multiply total_price by 7% to get sales_tax
5) Output total_price + sales_tax