Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Ah! Cafe menu again, but now I need help on something else..
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
alexandra96732




PostPosted: Wed Jun 07, 2006 6:15 pm   Post subject: Ah! Cafe menu again, but now I need help on something else..

Ahhh, so... I'm *sort of* done my menu. It works like a restaurant menu with different foods. Actually I'm trying to get the basics down, and I'm having diffiulty with my check order/ check out page. Basically, how would do you output the item name, price, total of ALL the items you've ordered so far, etc., because using if statements outputs the item name and info only once, plus it's glitched when I want to order the same item more than once or more than one item... Currently, out of my menu of food (yum) only my lasagna and muffin work. So when you go to check your order, and you've already ordered your muffin and lasagna, both should show up, no? I think I know why, but overall, I'm very confused. Yes, I did read Turing Walkthrough, and I can't really think of anything else to do... So I'm putting up my program, and it would be WONDERFUL if you could help~!

O____O
Thank youuuuu!

p.s. please ignore the 'add to cart' GUI button, because when you click on the food from the top menu, it automatically counts that/buys that for you.



summative22.t
 Description:
my menu program!=[

Download
 Filename:  summative22.t
 Filesize:  9.09 KB
 Downloaded:  77 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
bluedevils_77




PostPosted: Wed Jun 07, 2006 7:47 pm   Post subject: (No subject)

code???
alexandra96732




PostPosted: Wed Jun 07, 2006 8:06 pm   Post subject: (No subject)

the code is attached- it's in the attachment thing. .__. just click and download
Andy




PostPosted: Sun Jun 11, 2006 11:19 pm   Post subject: (No subject)

normally i would recommend using records to hold each of the items, but since this is due in 4 days, you'd better not worry about that.

Basicly what you want is to assign each of the items available to order a special ID, using this ID you will be able to access the name of the item, the price, and how many of it was ordered.

You started off right by using arrays to hold the name of the items, and an array to hold the price as well, but you still need another array to hold how many of the items was ordered.

Be sure to set all of the ordered quantities to 0 by default.

It may be wise to use the same GUI IDs to enumerate each item to avoid confusion.

once you have the arrays set up, this assignment simplifies down into a click and increment problem. All you need to do is to be able to tell which item was selected by the user, and simply add 1 to the corresponding element in the "quantities ordered" for that item.

When the person reaches check out, simply loop through each element of the "quantities ordered" array and output the number of items for all the non 0 elements

Feel free to ask any more questions here or email me
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: