Models the state of the machine and calculates the change to be given when an item is purchase