Vending machine help

I’m in the middle of doing a logarithm of the old vending machine problem. For those who don’t know what I’m talking about, simply put it is a school assignment where you have to describe all the steps to getting a soda out of a vending machine.
What I need to know is what kind of change will vending machines accept. Assume we are only using American money. I’m not worried about the coins, but I have no clue about bills. I know most machines will give you change for a dollar bill. What about a $5 or a $10 or $20??
Thanks for any and all help.

I’ve never seen a vending machine that takes anything other than a $1.00 bill. If there is a change machine nearby, though, most will take fives and some will take tens. Not sure aboout twenties.

Algorithm. It’s algorithm.

So sorry. I knew that I’m just tired and had a brain fart.

Our vending machines will accept nickles, dimes, quarters, and dollar coins (both SBA’s and Sackies). They will also take $1.00 bills, but nothing else (I think; I’ve never tried a 50¢ piece in them). Our bill changers, however, will give dollar coins (usually a mix of SBA’s and Sackies) for anything up to and including $20.00 bills. If that helps any.

Actually vending machines will take bills other than $1s. Usually thye are found in hotels etc where you’d buy things for more than a dollar.

Ditto Edward. For example, the machines for my commute sell train tickets, and they’ll take up to a $20. Same for stamp vending machines at the Post Office.

What kind of change would you receive from a twenty?Bills? Coins? If the change were bills, where would they come out of? (as you can probably tell I very seldom use a vending machine :slight_smile: )
Oh. And thanks for all the replies so far.

Usually I get SBA or Sackies in change. To the machines they are the same coins (same dimensions, weight, conductivity, etc).

Hang on. Different vending machines accept different denominations - some take bills, some just take coins, etc.

If this is not specified in your assignment, that means you are free to make whatever reasonable assumptions you like. Which means you get to decide how simple or complex the problem is.

If I were you I would assume the vending machine accepts only nickels, dimes, quarters and dollar coins.

Depending on the age and make of the vending machine, some of them do not handle bills very well. They will either kick out a 5 as not a valid bill, or will think that it’s a 1 and give you change accordingly. The newer ones recognize a 1 and a 5, and possibly higher values depending on what the machine was designed to do.

There is also a wide variance on whether or not they will accept 50 cent pieces and 1 dollar coins (susan B or the new dollar).

I agree with hibernicus, except that I would exclude dollars. Assume only nickels, dimes, and quarters.

This reminds me of my college days. I had to design state machines for a vending machine and an elevator.

Vending machines these days use microcontrollers. Takes all the fun out of it. There’s nothing like a good rom based state machine.

I bought a subway (Metro Rail, Washington DC) ticket from a station vending machine with a $20 bill and got the change back in quarters, 56 of them… Now I know better.

I appreciate all the replies. Tommorrow I think I’ll go look around my area to see what is “standard” for our vending machines. Feel free to keep replying though. The more answers I get the better. Thanks
Tina

I would suspect that the technology needed to distinguish a $1 from a $5 and larger bill would be reserved for machines that sell higher value items than a soda machine. Sodas are generally less than $1, and the machines are not designed to give out large amounts of change (see deball’s example) Someone dumping in a $20 for a soda could use up all of the machine’s change, leaving it unable to sell more soda, bad news for the vending company.

If your assignment is for a soda machine specifically, I would think that nickel, dime, quarter, dollar coin, dollar bill is all that you need.

Self-service supermarket checkout lanes take bills up to twenty (and may take fifties for all I know.) The depository for the bill is similar to a vending machine, so I mention it here. The change comes out in bills and coins.

Fifty-cent pieces aren’t usually accepted in vending machines, WAG since there are so few in circulation, and more pointedly, they would require a longer slot.