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

Username:   Password: 
 RegisterRegister   
 Need help on problem with a shop program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
legendz98




PostPosted: Sun May 27, 2012 5:22 pm   Post subject: Need help on problem with a shop program

What is it you are trying to achieve?
I am trying to create a shop program that consist of a introduction page, inventory page, information/purchase pages, a calculation page and a goodbye page.


What is the problem you are having?
I am currently doing my purchase pages. I created a checkout page where it is suppose to list the items that my customers want to purchase. With my coding it only allows me to list one of the four items I am selling. The variables that I have used to determine which item the user wants to buy are messed up.
For example.

procedure buy1
checkpage (1) := 6
Font.Draw ("Added to cart", 50, 300, descriptionfont2, black)
item (1) := "Paper Mate Mirado Pencils - 6-Pack"
put item (1)
put checkpage (1)
end buy1

procedure buy2
checkpage (2) := 7
item (2) := "Staedtler Mars Plastic Eraser - 2-Pack"
Font.Draw ("Added to cart", 50, 300, descriptionfont2, black)
item (2) := "Staedtler Mars Plastic Eraser - 2-Pack"
put item (2)
put checkpage (2)
end buy2

if i were to run procedure buy1 by selecting GUI.CreateButton named "add to cart" the variable item(1) becomes "Paper Mate Mirado Pencils - 6-Pack." When I used my back button, it brings me back to my inventory page and than i go into my 2nd product and click add to cart. The variable item(2) is suppose to become "Staedtler Mars Plastic Eraser - 2-Pack" but it doesn't. For some reason the variable item(2) becomes "Paper Mate Mirado Pencils - 6-Pack."

Describe what you have tried to solve this problem
I haven't tried much to try to solve this problem, I only recently discovered that the variable item(1) is making the variable item(2) become the value of item(1)


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)



Please specify what version of Turing you are using
4.1.1



Shop1.t
 Description:

Download
 Filename:  Shop1.t
 Filesize:  7.6 KB
 Downloaded:  56 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
turinggirl




PostPosted: Sun May 27, 2012 8:40 pm   Post subject: Re: Need help on problem with a shop program

It is pretty obvious that you have formatted your program incorrectly. Please double check your procedures.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: