How does a Vending Machine Work?

A vending machine, like everything else these days is run by a computer. You put your money in, the computer recognizes it, and tells the machine parts to spit you out a Snickers.