Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 16th, 2005, 6:54 AM   #1
sapphire^^
Newbie
 
Join Date: Oct 2005
Posts: 8
Rep Power: 0 sapphire^^ is on a distinguished road
help w/ vending machine - make sure coin inserted first?

hey,

ummm im having trouble programming a vendin machine

bcoz even if you don't insert a coin, but still press the button, a product will come out

does anyone noe how to make sure that the coin HAS to be inserted first?

thanks
sapphire^^ is offline   Reply With Quote
Old Oct 16th, 2005, 7:02 AM   #2
zorin
Hobbyist Programmer
 
Join Date: Apr 2005
Posts: 218
Rep Power: 4 zorin is on a distinguished road
So what language is this vending machine written then, C, C++, VB, Java ect..., LOL
zorin is offline   Reply With Quote
Old Oct 16th, 2005, 7:02 AM   #3
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 3 Polyphemus_ is on a distinguished road
well, when a coin is inserted, you raise a flag, let's say coin_inserted.. and the button only works when the flag is raised. Not that difficult.

Welcome to the forums, btw
Polyphemus_ is offline   Reply With Quote
Old Oct 16th, 2005, 7:09 AM   #4
sapphire^^
Newbie
 
Join Date: Oct 2005
Posts: 8
Rep Power: 0 sapphire^^ is on a distinguished road
hey,

i'm using a program called Microworlds - uses LOGO language... i think....

anywaiz, so how do i use flag?

i really don't get it...
sapphire^^ is offline   Reply With Quote
Old Oct 16th, 2005, 7:18 AM   #5
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 3 Polyphemus_ is on a distinguished road
do you actually know the language by flag i mean just a variable.. when a coin is inserted, the variable will contain 1, otherwise zero.
Polyphemus_ is offline   Reply With Quote
Old Oct 16th, 2005, 7:24 AM   #6
sapphire^^
Newbie
 
Join Date: Oct 2005
Posts: 8
Rep Power: 0 sapphire^^ is on a distinguished road
ummmm so how would i actually type in the procedures

that if the variable is 1, then the product can be selected

and if its 0 then ask the user to insert a coin?
sapphire^^ is offline   Reply With Quote
Old Oct 16th, 2005, 7:35 AM   #7
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 3 Polyphemus_ is on a distinguished road
exactly
Polyphemus_ is offline   Reply With Quote
Old Oct 16th, 2005, 7:43 AM   #8
sapphire^^
Newbie
 
Join Date: Oct 2005
Posts: 8
Rep Power: 0 sapphire^^ is on a distinguished road
kul! thanks
sapphire^^ is offline   Reply With Quote
Old Oct 16th, 2005, 11:09 AM   #9
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
Quote:
Originally Posted by sapphire^^
bcoz even if you don't insert a coin, but still press the button, a product will come out
That's almost the opposite of the machine we have at the university. You insert $1.25 and then it asks for the money again
OpenLoop is offline   Reply With Quote
Old Oct 16th, 2005, 11:46 AM   #10
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
If the flag doesn't work for you, try tipping it over to the side and shaking it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:57 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC