Your initial truth table does not represent the vending machine fully. Consider, for example, that a customer depositing $2 should be allowed to buy one tea or two waters. Consider also that the machine should be forgiving of over depositing for a given purchasing request.
Definitions:
Inputs
- d1-d2: binary encoding of money deposited.
- t: tea requested.
- w1-w2: binary encoding of number of waters requested.
Outputs
- A: Accept amount deposited and provide requested tea and water.
- D1-D2: binary encoding of change to return to buyer.
Truth Table
The following truth table captures
- multiple possible selections for a given deposit.
- change to be given if selection is less expensive than money deposited.
I N P U T S || O U T P U T S Depos | Request || Accept | Change d2 d1 | t w2 w1 || A | D2 D1 ----------------------------------- 0 0 | 0 0 0 || 0 | 0 0 0 0 | 0 0 1 || 0 | 0 0 0 0 | 0 1 0 || 0 | 0 0 0 0 | 0 1 1 || 0 | 0 0 0 0 | 1 0 0 || 0 | 0 0 0 0 | 1 0 1 || 0 | 0 0 0 0 | 1 1 0 || 0 | 0 0 0 0 | 1 1 1 || 0 | 0 0 0 1 | 0 0 0 || 0 | 0 0 0 1 | 0 0 1 || 1 | 0 0 0 1 | 0 1 0 || 0 | 0 0 0 1 | 0 1 1 || 0 | 0 0 0 1 | 1 0 0 || 0 | 0 0 0 1 | 1 0 1 || 0 | 0 0 0 1 | 1 1 0 || 0 | 0 0 0 1 | 1 1 1 || 0 | 0 0 1 0 | 0 0 0 || 0 | 0 0 1 0 | 0 0 1 || 1 | 0 1 1 0 | 0 1 0 || 1 | 0 0 1 0 | 0 1 1 || 0 | 0 0 1 0 | 1 0 0 || 1 | 0 0 1 0 | 1 0 1 || 0 | 0 0 1 0 | 1 1 0 || 0 | 0 0 1 0 | 1 1 1 || 0 | 0 0 1 1 | 0 0 0 || 0 | 0 0 1 1 | 0 0 1 || 1 | 1 0 1 1 | 0 1 0 || 1 | 0 1 1 1 | 0 1 1 || 1 | 0 0 1 1 | 1 0 0 || 1 | 0 1 1 1 | 1 0 1 || 1 | 0 0 1 1 | 1 1 0 || 0 | 0 0 1 1 | 1 1 1 || 0 | 0 0