Algorithm Problem, Urgent

I know Im brand new on this site and this is very rude to just come on and post a question i have but i dont know where else to go. Im going to college now to major in programming and i have to take a alg/flowcharting class and my prof in there is a jerk. The only algorithm i have done is directions to my house...He said not to contact him out of class and a lot of the other students i have asked are totally clueless also. Please help.

This is a worksheet he gave us.

1)Write the algorithm.

2)Using VISIO, draw the Flowchart.

Mrs. Butterworth received a computer for her local business to assist her with her day to day activities. She has a request for you to develop a solution/program to the following problem/opportunity:

When a customer comes in to her fudge shop, they may purchase more than one type of fudge flavors. The current process is for her to enter one purchase and then calculate the taxes on that one purchase for a total bill.

For example one: (Only one sale)

One Pound Chocolate Fudge $4.99

Sales Tax at 6% $0.30

Final Cost$5.29

For example two: (Multiple sales)

One Pound Chocolate Fudge $4.99

One Pound Peanut Butter Fudge$5.49

Two Pounds Vanilla Cluster$11.89

One Pound Cherry Nut Fudge$3.99

Total Purchase $26.36

Sales Tax at 6% $1.58

Final Cost$27.94

Design the logic using an algorithm and flowchart to have Mrs. Butterworth input the sale for one item and calculate the total due. Purchase price plus taxes equal total due. See Example One.

Challenge: Have the option to continue entering more sales. Once all the sales have been entered, multiply the total sales by .06%. Add the total purchase and sales tax to arrive at the final cost. Display the results and print out a receipt when the order is completed. See Example 2.

[1881 byte] By [Lepinat0ra] at [2007-11-27 6:15:49]
# 1
> alg/flowcharting class and my prof in there is a> jerk. your prof is reading these forums> Please help.okay. its not really very urgent though, is it?anyway, specifically, what part don't your understand? what have you done so far?
OnBringera at 2007-7-12 17:26:53 > top of Java-index,Other Topics,Algorithms...
# 2
i havent done any of it.. i dont know where to start.
Lepinat0ra at 2007-7-12 17:26:53 > top of Java-index,Other Topics,Algorithms...
# 3

start with this:

"

Design the logic using an algorithm and flowchart to have Mrs. Butterworth input the sale for one item and calculate the total due. Purchase price plus taxes equal total due. See Example One.

One Pound Chocolate Fudge $4.99

Sales Tax at 6% $0.30

Final Cost $5.29

"

it's difficult to help you without knowing, specifically, what is the problem? are there words in your assignment that you don't understand? if so, a good start would be explaining which parts are unclear

OnBringera at 2007-7-12 17:26:53 > top of Java-index,Other Topics,Algorithms...
# 4
I just have no idea to word it. But would this be close?Ask number of PurchaseAsk price of ItemIf Purchase is 1 thencalculate item * $0.06 for total
Lepinat0ra at 2007-7-12 17:26:53 > top of Java-index,Other Topics,Algorithms...
# 5

I don't know if this is what you're looking for, since it is not very clear what exactly you need to help with, but anyway.

I would do it like this ...

1. Ask for price of the first item (store it in memory)

2. Ask if she wants to add another item

__ YES: go to 1.

__ NO: continue

3. Add all prices together

4. Calculate the tax

Hope it helps.

Babantika at 2007-7-12 17:26:53 > top of Java-index,Other Topics,Algorithms...
# 6

> I know Im brand new on this site and this is very

> rude to just come on and post a question i have but i

> dont know where else to go.

It's not rude at all to post a question. That's what this forum is all about. It is rude however to just copy and paste an assignment verbatim and expect others to make your homework.

> Im going to college now

> to major in programming and i have to take a

> alg/flowcharting class

Algorithm-Flowchart class?

> and my prof in there is a jerk.

Right.

This is where I lost interest in your "question".

I suggest switching majors while you still can. Perhaps law is more your cup of tea?

> ...

prometheuzza at 2007-7-12 17:26:53 > top of Java-index,Other Topics,Algorithms...
# 7

> > I know Im brand new on this site and this is very

> > rude to just come on and post a question i have but

> i

> > dont know where else to go.

>

> It's not rude at all to post a question. That's what

> this forum is all about. It is rude however to just

> copy and paste an assignment verbatim and expect

> others to make your homework.

>

And it's especially rude to claim that "it's urgent", hinting that your homework assignment is more important than the multimillion dollar projects many of us work on.

>

> > Im going to college now

> > to major in programming and i have to take a

> > alg/flowcharting class

>

> Algorithm-Flowchart class?

>

knowing how to create flowcharts is an important skill in programming, especially in procedural programming.

Also helps visualise a lot of algorithms.

>

> > and my prof in there is a jerk.

>

> Right.

> This is where I lost interest in your "question".

> I suggest switching majors while you still can.

> Perhaps law is more your cup of tea?

>

Cooking, he'll need those skills if he wants to do more than flip burgers after he fails.

jwentinga at 2007-7-12 17:26:53 > top of Java-index,Other Topics,Algorithms...
# 8

OK, I've been through your pain (no not the homework, being ripped apart on the forums). But dont worry... You get used to it and eventually learn how to ask a question...

Now... Your algorithm needs a looped input and then simple addition and multiplication.

Here are some ideas:

....

//MOST OF THESE THINGS AREN'T INITIALIZED!!!

Scanner input; //initialize this, just google "java scanner"

List item_names; //just incase u wanna store names (doesnt seem like u need to though)

List item_prices;

while ( true ) //item addition loop

{

String name = input.nextLine()

float price = input.next();

item_names.add(""+name);

item_prices.add(""+price);

(Ask user if they want another item)

--> Yes? then

continue;

--> No? then

return;

}

//SUM ALL ITEMS

float sum = 0;

for ( Object obj : item_prices )

{

int value = (convert to string then to int with some parse method)obj;

sum += value;

}

float tax = sum*0.06f;

float total = sum+tax;

....

There you go... thats the algorithm (basically), the flowchart is up to u... enjoy

ArikArikArika at 2007-7-12 17:26:53 > top of Java-index,Other Topics,Algorithms...