Thimble Sodas:

a (harder) finite state machine

The Thimble Soda Company sells thimble-sized sodas "guaranteed to leave you wanting more" ("bet you can't drink just 100?"). The cost of a soda pop is 15 cents.

We'll design a finite state machine to describe its behavior, given the following assumptions.

Inputs: The machine can take only nickels (N) and dimes (D). Other inputs include pushing one of the flavor selection buttons (green gloop or purple ploop), and finally, the input of kicking the machine out of frustration.

We'll indicate these inputs by N, D, G, P, and K.

Outputs: The machine dispenses either a green gloop or a purple ploop, provided that 15 cents have been received. If too much money has been input (for example, if a customer has only two dimes), then change will be given. We indicate the outputs by the letters N (nickel change), D (dime change), G (green gloop output), and P (purple ploop output).

If the machine is kicked, then it becomes very unhappy, and goes to a "dead" state, after which it refuses to respond to any input.

On the reverse side, or on a separate piece of paper, draw a state diagram for the Thimble soda dispenser.