refactored VendingMachine class, and tests accordingly.