# very very basic algorithm problem about selection and repetition.

Discussion in 'Mac Programming' started by benlangdon, Feb 25, 2008.

1. ### benlangdon macrumors 65832

Joined:
Jan 13, 2008
#1
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

2. ### ipo macrumors member

Joined:
Sep 6, 2007
#2
Wtf !?

?! 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 !?

3. ### benlangdon thread starter macrumors 65832

Joined:
Jan 13, 2008
#3
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

4. ### toddburch macrumors 6502a

Joined:
Dec 4, 2006
Location:
Katy, Texas
#4
Do you mean like this:

Code:
```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
```