A vending machine is a machine which dispenses items such as snacks, beverages, alcohol, cigarettes, lottery tickets, consumer products and even gold and gems to customers automatically, after the customer inserts currency or credit into the machine.The first reference to a vending machine is in the work of Hero of Alexandria, a first-century engineer and mathematician. His machine accepted a coin and then dispensed holy water. When the coin was deposited, it fell upon a pan attached to a lever. The lever opened a valve which let some water flow out. The pan continued to tilt with the weight of the coin until it fell off, at which point a counterweight snapped the lever up and turned off the valve.Vending machines waited for the Industrial Age before coming to prominence. The first modern coin-operated vending machines were introduced in London, England in the early 1880s, dispensing post cards. The first vending machine in the U.S. was built in 1888 by the Thomas Adams Gum Company, selling gum on New York City train platforms.