ticket_sold names the ticket machine state reached after a credit card is validated and a ticket is sold. The customer can now take the ticket. section 13.1
While ticket_sold is active, customer actions produce state-specific behavior:
- Inserting a card or checking validity tells the customer to take the ticket already bought. section 13.1.2
- Taking the ticket removes the card, displays an enjoyment message, decrements the ticket count, and transitions to READY or SOLD_OUT. section 13.1.2 section 13.1.3
- Removing the card first is rejected with a request to take the ticket. section 13.1.2
A successful sale
The machine moves from READY to VALIDATING when a card is inserted, then to ticket_sold after validation. Taking the ticket changes the count from three to two and returns the machine to READY. section 13.1
Figure 13.1 A UML state diagram showing the four states and the state transitions of an automatic ticket machine. The machine keeps track of the number of tickets it has, whether there is a credit card inserted, and the validity status of the card. Customer and machine actions (numbered; e.g., 1: insert card) or certain conditions (in square brackets; e.g., [card invalid]) can cause transitions from one state to another. This figure only shows the actions that cause transitions.
Use the state diagram to trace ticket_sold's incoming and outgoing transitions alongside the other ticket-machine states. section 13.1
